From: Hans Leidekker hans@codeweavers.com
Currently we parse composable access as an attribute of the composable attribute which doesn't seem right conceptually. More importantly make_exprt() ignores any attributes on the variable declaration which means the value isn't available for metadata generation. --- tools/widl/parser.y | 18 ++++++++++-------- tools/widl/widltypes.h | 6 ++++++ 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 54b143637cf..e252385bf53 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -289,7 +289,6 @@ PARSER_LTYPE pop_import(void); %token tWCHAR tWIREMARSHAL %token tAPARTMENT tNEUTRAL tSINGLE tFREE tBOTH
-%type <attr> access_attr %type <attr> attribute acf_attribute %type <attr_list> m_attributes attributes attrib_list %type <attr_list> acf_attributes acf_attribute_list @@ -336,7 +335,7 @@ PARSER_LTYPE pop_import(void); %type <type> coclass coclassdef %type <type> runtimeclass runtimeclass_def %type <type> apicontract apicontract_def -%type <num> contract_ver +%type <num> contract_ver composable_access %type <num> pointer_type threading_type marshaling_behavior version %type <str> libraryhdr callconv cppquote importlib import %type <str> typename m_typename @@ -623,16 +622,19 @@ activatable_attr: | contract_req { $$ = $1; } /* activatable on the default activation factory */ ;
-access_attr - : tPUBLIC { $$ = attr_int( @$, ATTR_PUBLIC, 0 ); } - | tPROTECTED { $$ = attr_int( @$, ATTR_PROTECTED, 0 ); } +composable_access + : tPUBLIC { $$ = COMPOSABLE_ACCESS_PUBLIC; } + | tPROTECTED { $$ = COMPOSABLE_ACCESS_PROTECTED; } ;
composable_attr - : decl_spec ',' access_attr ',' contract_req - { if ($1->type->type_type != TYPE_INTERFACE) + : decl_spec ',' composable_access ',' contract_req + { struct integer integer = { .value = $3 }; + if ($1->type->type_type != TYPE_INTERFACE) error_loc( "type %s is not an interface\n", $1->type->name ); - $$ = make_exprt( EXPR_MEMBER, declare_var( append_attr( NULL, $3 ), $1, make_declarator( NULL ), 0 ), $5 ); + $$ = make_exprl( EXPR_NUM, &integer ); + $$ = make_expr2( EXPR_MEMBER, $$, $5 ); + $$ = make_exprt( EXPR_MEMBER, declare_var( NULL, $1, make_declarator( NULL ), 0 ), $$ ); } ;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 1b032a17c4a..5b3967bc942 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -314,6 +314,12 @@ enum type_basic_type #define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8 #define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER
+enum composable_access +{ + COMPOSABLE_ACCESS_PROTECTED = 1, + COMPOSABLE_ACCESS_PUBLIC, +}; + struct location { const char *input_name;