hidl-gen: remove support for anonymous enums.
* There is no anonymous things allow in HIDL.
Scope::pickUniqueAnonymousName is removed.
Test: hidl_test
Test: cd system/tools/hidl && mma
Test: cd hardware/interfaces && mma
Change-Id: Iebcb001b34e05b32378dbcb8b2b06e045d8c221a
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index b606564..1b6ae5c 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -98,12 +98,11 @@
/* Precedence level 3, RTL; but we have to use %left here */
%left UNARY_MINUS UNARY_PLUS '!' '~'
-%type<str> optIdentifier package
+%type<str> package
%type<fqName> fqname
%type<type> fqtype
%type<type> type opt_storage_type
-%type<type> enum_declaration
%type<type> opt_extends
%type<type> type_declaration_body interface_declaration typedef_declaration
%type<type> named_struct_or_union_declaration named_enum_declaration
@@ -590,7 +589,7 @@
compound_declaration
: named_struct_or_union_declaration { $$ = $1; }
- | enum_declaration { $$ = $1; }
+ | named_enum_declaration { $$ = $1; }
;
opt_storage_type
@@ -633,46 +632,6 @@
}
;
-enum_declaration
- : ENUM
- {
- std::string anonName = ast->scope()->pickUniqueAnonymousName();
- ast->enterScope(new EnumType(anonName.c_str()));
- }
- enum_declaration_body
- {
-
- EnumType *enumType = static_cast<EnumType *>(ast->scope());
- ast->leaveScope();
-
- std::string errorMsg;
- if (!ast->addScopedType(enumType, &errorMsg)) {
- // This should never fail.
- std::cerr << "ERROR: " << errorMsg << "\n";
- YYERROR;
- }
-
- $$ = enumType;
- }
- | ENUM IDENTIFIER opt_storage_type
- {
- ast->enterScope(new EnumType($2, $3));
- }
- enum_declaration_body
- {
- EnumType *enumType = static_cast<EnumType *>(ast->scope());
- ast->leaveScope();
-
- std::string errorMsg;
- if (!ast->addScopedType(enumType, &errorMsg)) {
- std::cerr << "ERROR: " << errorMsg << " at " << @2 << "\n";
- YYERROR;
- }
-
- $$ = enumType;
- }
- ;
-
enum_declaration_body
: '{' enum_values opt_comma '}' { $$ = $2; }
;
@@ -739,11 +698,6 @@
| INTERFACE { $$ = new GenericBinder; }
;
-optIdentifier
- : /* empty */ { $$ = NULL; }
- | IDENTIFIER { $$ = $1; }
- ;
-
%%
#include <android-base/logging.h>