Merge "PointerType: disallow embedded"
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 3932006..019b41d 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -294,7 +294,7 @@
%type<constantExpression> const_expr
%type<enumValue> enum_value commentable_enum_value
%type<enumValues> enum_values enum_declaration_body
-%type<typedVars> typed_vars
+%type<typedVars> typed_vars non_empty_typed_vars
%type<typedVar> typed_var
%type<method> method_declaration commentable_method_declaration
%type<compoundStyle> struct_or_union_keyword
@@ -844,7 +844,14 @@
{
$$ = new TypedVarVector();
}
- | typed_var
+ | non_empty_typed_vars
+ {
+ $$ = $1;
+ }
+ ;
+
+non_empty_typed_vars
+ : typed_var
{
$$ = new TypedVarVector();
if (!$$->add($1)) {
@@ -853,7 +860,7 @@
ast->addSyntaxError();
}
}
- | typed_vars ',' typed_var
+ | non_empty_typed_vars ',' typed_var
{
$$ = $1;
if (!$$->add($3)) {
diff --git a/test/error_test/Android.bp b/test/error_test/Android.bp
index 42345b2..4c8c899 100644
--- a/test/error_test/Android.bp
+++ b/test/error_test/Android.bp
@@ -6,8 +6,6 @@
"echo 'int main(){return 0;}' > $(genDir)/TODO_b_37575883.cpp",
out: ["TODO_b_37575883.cpp"],
srcs: [
- "hidl_error_test.sh",
-
"**/*.hal",
"**/required_error",
],
diff --git a/test/error_test/no_leading_comma_argument_list/1.0/IFoo.hal b/test/error_test/no_leading_comma_argument_list/1.0/IFoo.hal
new file mode 100644
index 0000000..a3946eb
--- /dev/null
+++ b/test/error_test/no_leading_comma_argument_list/1.0/IFoo.hal
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package test.no_leading_comma_argument_list@1.0;
+
+interface IFoo {
+ foo(, int32_t v);
+};
diff --git a/test/error_test/no_leading_comma_argument_list/1.0/required_error b/test/error_test/no_leading_comma_argument_list/1.0/required_error
new file mode 100644
index 0000000..b8795e6
--- /dev/null
+++ b/test/error_test/no_leading_comma_argument_list/1.0/required_error
@@ -0,0 +1 @@
+syntax error, unexpected ','
diff --git a/test/error_test/no_leading_comma_result_list/1.0/IFoo.hal b/test/error_test/no_leading_comma_result_list/1.0/IFoo.hal
new file mode 100644
index 0000000..dab99cb
--- /dev/null
+++ b/test/error_test/no_leading_comma_result_list/1.0/IFoo.hal
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package test.no_leading_comma_result_list@1.0;
+
+interface IFoo {
+ foo() generates (, int32_t v);
+};
diff --git a/test/error_test/no_leading_comma_result_list/1.0/required_error b/test/error_test/no_leading_comma_result_list/1.0/required_error
new file mode 100644
index 0000000..b8795e6
--- /dev/null
+++ b/test/error_test/no_leading_comma_result_list/1.0/required_error
@@ -0,0 +1 @@
+syntax error, unexpected ','