Commit 7771a9ae authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

widl: Simplify attribute creation with either int or ptr value.

parent f36fbb37
......@@ -24,15 +24,7 @@
#include "parser.tab.h"
attr_t *make_attr( enum attr_type attr_type )
{
attr_t *a = xmalloc( sizeof(attr_t) );
a->type = attr_type;
a->u.ival = 0;
return a;
}
attr_t *make_attrv( enum attr_type attr_type, unsigned int val )
attr_t *attr_int( enum attr_type attr_type, unsigned int val )
{
attr_t *a = xmalloc( sizeof(attr_t) );
a->type = attr_type;
......@@ -40,7 +32,7 @@ attr_t *make_attrv( enum attr_type attr_type, unsigned int val )
return a;
}
attr_t *make_attrp( enum attr_type attr_type, void *val )
attr_t *attr_ptr( enum attr_type attr_type, void *val )
{
attr_t *a = xmalloc( sizeof(attr_t) );
a->type = attr_type;
......
......@@ -607,125 +607,125 @@ activatable_attr:
attribute
: %empty { $$ = NULL; }
| tACTIVATABLE '(' activatable_attr ')' { $$ = make_attrp( ATTR_ACTIVATABLE, $3 ); }
| tAGGREGATABLE { $$ = make_attr( ATTR_AGGREGATABLE ); }
| tANNOTATION '(' aSTRING ')' { $$ = make_attrp( ATTR_ANNOTATION, $3 ); }
| tAPPOBJECT { $$ = make_attr( ATTR_APPOBJECT ); }
| tASYNC { $$ = make_attr( ATTR_ASYNC ); }
| tAUTOHANDLE { $$ = make_attr( ATTR_AUTO_HANDLE ); }
| tBINDABLE { $$ = make_attr( ATTR_BINDABLE ); }
| tBROADCAST { $$ = make_attr( ATTR_BROADCAST ); }
| tCALLAS '(' ident ')' { $$ = make_attrp( ATTR_CALLAS, $3 ); }
| tCASE '(' expr_list_int_const ')' { $$ = make_attrp( ATTR_CASE, $3 ); }
| tCODE { $$ = make_attr( ATTR_CODE ); }
| tCOMMSTATUS { $$ = make_attr( ATTR_COMMSTATUS ); }
| tCONTEXTHANDLE { $$ = make_attrv( ATTR_CONTEXTHANDLE, 0 ); }
| tCONTEXTHANDLENOSERIALIZE { $$ = make_attrv( ATTR_CONTEXTHANDLE, 0 ); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ }
| tCONTEXTHANDLESERIALIZE { $$ = make_attrv( ATTR_CONTEXTHANDLE, 0 ); /* RPC_CONTEXT_HANDLE_SERIALIZE */ }
| tCONTRACT '(' contract_req ')' { $$ = make_attrp( ATTR_CONTRACT, $3 ); }
| tCONTRACTVERSION '(' contract_ver ')' { $$ = make_attrv( ATTR_CONTRACTVERSION, $3 ); }
| tCONTROL { $$ = make_attr( ATTR_CONTROL ); }
| tACTIVATABLE '(' activatable_attr ')' { $$ = attr_ptr( ATTR_ACTIVATABLE, $3 ); }
| tAGGREGATABLE { $$ = attr_int( ATTR_AGGREGATABLE, 0 ); }
| tANNOTATION '(' aSTRING ')' { $$ = attr_ptr( ATTR_ANNOTATION, $3 ); }
| tAPPOBJECT { $$ = attr_int( ATTR_APPOBJECT, 0 ); }
| tASYNC { $$ = attr_int( ATTR_ASYNC, 0 ); }
| tAUTOHANDLE { $$ = attr_int( ATTR_AUTO_HANDLE, 0 ); }
| tBINDABLE { $$ = attr_int( ATTR_BINDABLE, 0 ); }
| tBROADCAST { $$ = attr_int( ATTR_BROADCAST, 0 ); }
| tCALLAS '(' ident ')' { $$ = attr_ptr( ATTR_CALLAS, $3 ); }
| tCASE '(' expr_list_int_const ')' { $$ = attr_ptr( ATTR_CASE, $3 ); }
| tCODE { $$ = attr_int( ATTR_CODE, 0 ); }
| tCOMMSTATUS { $$ = attr_int( ATTR_COMMSTATUS, 0 ); }
| tCONTEXTHANDLE { $$ = attr_int( ATTR_CONTEXTHANDLE, 0 ); }
| tCONTEXTHANDLENOSERIALIZE { $$ = attr_int( ATTR_CONTEXTHANDLE, 0 ); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ }
| tCONTEXTHANDLESERIALIZE { $$ = attr_int( ATTR_CONTEXTHANDLE, 0 ); /* RPC_CONTEXT_HANDLE_SERIALIZE */ }
| tCONTRACT '(' contract_req ')' { $$ = attr_ptr( ATTR_CONTRACT, $3 ); }
| tCONTRACTVERSION '(' contract_ver ')' { $$ = attr_int( ATTR_CONTRACTVERSION, $3 ); }
| tCONTROL { $$ = attr_int( ATTR_CONTROL, 0 ); }
| tCUSTOM '(' aUUID ',' expr_const ')' { $$ = make_custom_attr( $3, $5 ); }
| tDECODE { $$ = make_attr( ATTR_DECODE ); }
| tDEFAULT { $$ = make_attr( ATTR_DEFAULT ); }
| tDEFAULTBIND { $$ = make_attr( ATTR_DEFAULTBIND ); }
| tDEFAULTCOLLELEM { $$ = make_attr( ATTR_DEFAULTCOLLELEM ); }
| tDEFAULTVALUE '(' expr_const ')' { $$ = make_attrp( ATTR_DEFAULTVALUE, $3 ); }
| tDEFAULTVTABLE { $$ = make_attr( ATTR_DEFAULTVTABLE ); }
| tDISABLECONSISTENCYCHECK { $$ = make_attr( ATTR_DISABLECONSISTENCYCHECK ); }
| tDISPLAYBIND { $$ = make_attr( ATTR_DISPLAYBIND ); }
| tDLLNAME '(' aSTRING ')' { $$ = make_attrp( ATTR_DLLNAME, $3 ); }
| tDUAL { $$ = make_attr( ATTR_DUAL ); }
| tENABLEALLOCATE { $$ = make_attr( ATTR_ENABLEALLOCATE ); }
| tENCODE { $$ = make_attr( ATTR_ENCODE ); }
| tENDPOINT '(' str_list ')' { $$ = make_attrp( ATTR_ENDPOINT, $3 ); }
| tENTRY '(' expr_const ')' { $$ = make_attrp( ATTR_ENTRY, $3 ); }
| tEVENTADD { $$ = make_attr( ATTR_EVENTADD ); }
| tEVENTREMOVE { $$ = make_attr( ATTR_EVENTREMOVE ); }
| tDECODE { $$ = attr_int( ATTR_DECODE, 0 ); }
| tDEFAULT { $$ = attr_int( ATTR_DEFAULT, 0 ); }
| tDEFAULTBIND { $$ = attr_int( ATTR_DEFAULTBIND, 0 ); }
| tDEFAULTCOLLELEM { $$ = attr_int( ATTR_DEFAULTCOLLELEM, 0 ); }
| tDEFAULTVALUE '(' expr_const ')' { $$ = attr_ptr( ATTR_DEFAULTVALUE, $3 ); }
| tDEFAULTVTABLE { $$ = attr_int( ATTR_DEFAULTVTABLE, 0 ); }
| tDISABLECONSISTENCYCHECK { $$ = attr_int( ATTR_DISABLECONSISTENCYCHECK, 0 ); }
| tDISPLAYBIND { $$ = attr_int( ATTR_DISPLAYBIND, 0 ); }
| tDLLNAME '(' aSTRING ')' { $$ = attr_ptr( ATTR_DLLNAME, $3 ); }
| tDUAL { $$ = attr_int( ATTR_DUAL, 0 ); }
| tENABLEALLOCATE { $$ = attr_int( ATTR_ENABLEALLOCATE, 0 ); }
| tENCODE { $$ = attr_int( ATTR_ENCODE, 0 ); }
| tENDPOINT '(' str_list ')' { $$ = attr_ptr( ATTR_ENDPOINT, $3 ); }
| tENTRY '(' expr_const ')' { $$ = attr_ptr( ATTR_ENTRY, $3 ); }
| tEVENTADD { $$ = attr_int( ATTR_EVENTADD, 0 ); }
| tEVENTREMOVE { $$ = attr_int( ATTR_EVENTREMOVE, 0 ); }
| tEXCLUSIVETO '(' decl_spec ')' { if ($3->type->type_type != TYPE_RUNTIMECLASS)
error_loc( "type %s is not a runtimeclass\n", $3->type->name );
$$ = make_attrp( ATTR_EXCLUSIVETO, $3->type );
$$ = attr_ptr( ATTR_EXCLUSIVETO, $3->type );
}
| tEXPLICITHANDLE { $$ = make_attr( ATTR_EXPLICIT_HANDLE ); }
| tFAULTSTATUS { $$ = make_attr( ATTR_FAULTSTATUS ); }
| tFLAGS { $$ = make_attr( ATTR_FLAGS ); }
| tFORCEALLOCATE { $$ = make_attr( ATTR_FORCEALLOCATE ); }
| tHANDLE { $$ = make_attr( ATTR_HANDLE ); }
| tHELPCONTEXT '(' expr_int_const ')' { $$ = make_attrp( ATTR_HELPCONTEXT, $3 ); }
| tHELPFILE '(' aSTRING ')' { $$ = make_attrp( ATTR_HELPFILE, $3 ); }
| tHELPSTRING '(' aSTRING ')' { $$ = make_attrp( ATTR_HELPSTRING, $3 ); }
| tEXPLICITHANDLE { $$ = attr_int( ATTR_EXPLICIT_HANDLE, 0 ); }
| tFAULTSTATUS { $$ = attr_int( ATTR_FAULTSTATUS, 0 ); }
| tFLAGS { $$ = attr_int( ATTR_FLAGS, 0 ); }
| tFORCEALLOCATE { $$ = attr_int( ATTR_FORCEALLOCATE, 0 ); }
| tHANDLE { $$ = attr_int( ATTR_HANDLE, 0 ); }
| tHELPCONTEXT '(' expr_int_const ')' { $$ = attr_ptr( ATTR_HELPCONTEXT, $3 ); }
| tHELPFILE '(' aSTRING ')' { $$ = attr_ptr( ATTR_HELPFILE, $3 ); }
| tHELPSTRING '(' aSTRING ')' { $$ = attr_ptr( ATTR_HELPSTRING, $3 ); }
| tHELPSTRINGCONTEXT '(' expr_int_const ')'
{ $$ = make_attrp( ATTR_HELPSTRINGCONTEXT, $3 ); }
| tHELPSTRINGDLL '(' aSTRING ')' { $$ = make_attrp( ATTR_HELPSTRINGDLL, $3 ); }
| tHIDDEN { $$ = make_attr( ATTR_HIDDEN ); }
| tID '(' expr_int_const ')' { $$ = make_attrp( ATTR_ID, $3 ); }
| tIDEMPOTENT { $$ = make_attr( ATTR_IDEMPOTENT ); }
| tIGNORE { $$ = make_attr( ATTR_IGNORE ); }
| tIIDIS '(' expr ')' { $$ = make_attrp( ATTR_IIDIS, $3 ); }
| tIMMEDIATEBIND { $$ = make_attr( ATTR_IMMEDIATEBIND ); }
| tIMPLICITHANDLE '(' arg ')' { $$ = make_attrp( ATTR_IMPLICIT_HANDLE, $3 ); }
| tIN { $$ = make_attr( ATTR_IN ); }
| tINPUTSYNC { $$ = make_attr( ATTR_INPUTSYNC ); }
| tLENGTHIS '(' m_exprs ')' { $$ = make_attrp( ATTR_LENGTHIS, $3 ); }
| tLCID '(' expr_int_const ')' { $$ = make_attrp( ATTR_LIBLCID, $3 ); }
| tLCID { $$ = make_attr( ATTR_PARAMLCID ); }
| tLICENSED { $$ = make_attr( ATTR_LICENSED ); }
| tLOCAL { $$ = make_attr( ATTR_LOCAL ); }
{ $$ = attr_ptr( ATTR_HELPSTRINGCONTEXT, $3 ); }
| tHELPSTRINGDLL '(' aSTRING ')' { $$ = attr_ptr( ATTR_HELPSTRINGDLL, $3 ); }
| tHIDDEN { $$ = attr_int( ATTR_HIDDEN, 0 ); }
| tID '(' expr_int_const ')' { $$ = attr_ptr( ATTR_ID, $3 ); }
| tIDEMPOTENT { $$ = attr_int( ATTR_IDEMPOTENT, 0 ); }
| tIGNORE { $$ = attr_int( ATTR_IGNORE, 0 ); }
| tIIDIS '(' expr ')' { $$ = attr_ptr( ATTR_IIDIS, $3 ); }
| tIMMEDIATEBIND { $$ = attr_int( ATTR_IMMEDIATEBIND, 0 ); }
| tIMPLICITHANDLE '(' arg ')' { $$ = attr_ptr( ATTR_IMPLICIT_HANDLE, $3 ); }
| tIN { $$ = attr_int( ATTR_IN, 0 ); }
| tINPUTSYNC { $$ = attr_int( ATTR_INPUTSYNC, 0 ); }
| tLENGTHIS '(' m_exprs ')' { $$ = attr_ptr( ATTR_LENGTHIS, $3 ); }
| tLCID '(' expr_int_const ')' { $$ = attr_ptr( ATTR_LIBLCID, $3 ); }
| tLCID { $$ = attr_int( ATTR_PARAMLCID, 0 ); }
| tLICENSED { $$ = attr_int( ATTR_LICENSED, 0 ); }
| tLOCAL { $$ = attr_int( ATTR_LOCAL, 0 ); }
| tMARSHALINGBEHAVIOR '(' marshaling_behavior ')'
{ $$ = make_attrv( ATTR_MARSHALING_BEHAVIOR, $3 ); }
| tMAYBE { $$ = make_attr( ATTR_MAYBE ); }
| tMESSAGE { $$ = make_attr( ATTR_MESSAGE ); }
| tNOCODE { $$ = make_attr( ATTR_NOCODE ); }
| tNONBROWSABLE { $$ = make_attr( ATTR_NONBROWSABLE ); }
| tNONCREATABLE { $$ = make_attr( ATTR_NONCREATABLE ); }
| tNONEXTENSIBLE { $$ = make_attr( ATTR_NONEXTENSIBLE ); }
| tNOTIFY { $$ = make_attr( ATTR_NOTIFY ); }
| tNOTIFYFLAG { $$ = make_attr( ATTR_NOTIFYFLAG ); }
| tOBJECT { $$ = make_attr( ATTR_OBJECT ); }
| tODL { $$ = make_attr( ATTR_ODL ); }
| tOLEAUTOMATION { $$ = make_attr( ATTR_OLEAUTOMATION ); }
| tOPTIMIZE '(' aSTRING ')' { $$ = make_attrp( ATTR_OPTIMIZE, $3 ); }
| tOPTIONAL { $$ = make_attr( ATTR_OPTIONAL ); }
| tOUT { $$ = make_attr( ATTR_OUT ); }
| tOVERLOAD '(' aSTRING ')' { $$ = make_attrp( ATTR_OVERLOAD, $3 ); }
| tPARTIALIGNORE { $$ = make_attr( ATTR_PARTIALIGNORE ); }
| tPOINTERDEFAULT '(' pointer_type ')' { $$ = make_attrv( ATTR_POINTERDEFAULT, $3 ); }
| tPROGID '(' aSTRING ')' { $$ = make_attrp( ATTR_PROGID, $3 ); }
| tPROPGET { $$ = make_attr( ATTR_PROPGET ); }
| tPROPPUT { $$ = make_attr( ATTR_PROPPUT ); }
| tPROPPUTREF { $$ = make_attr( ATTR_PROPPUTREF ); }
| tPROXY { $$ = make_attr( ATTR_PROXY ); }
| tPUBLIC { $$ = make_attr( ATTR_PUBLIC ); }
{ $$ = attr_int( ATTR_MARSHALING_BEHAVIOR, $3 ); }
| tMAYBE { $$ = attr_int( ATTR_MAYBE, 0 ); }
| tMESSAGE { $$ = attr_int( ATTR_MESSAGE, 0 ); }
| tNOCODE { $$ = attr_int( ATTR_NOCODE, 0 ); }
| tNONBROWSABLE { $$ = attr_int( ATTR_NONBROWSABLE, 0 ); }
| tNONCREATABLE { $$ = attr_int( ATTR_NONCREATABLE, 0 ); }
| tNONEXTENSIBLE { $$ = attr_int( ATTR_NONEXTENSIBLE, 0 ); }
| tNOTIFY { $$ = attr_int( ATTR_NOTIFY, 0 ); }
| tNOTIFYFLAG { $$ = attr_int( ATTR_NOTIFYFLAG, 0 ); }
| tOBJECT { $$ = attr_int( ATTR_OBJECT, 0 ); }
| tODL { $$ = attr_int( ATTR_ODL, 0 ); }
| tOLEAUTOMATION { $$ = attr_int( ATTR_OLEAUTOMATION, 0 ); }
| tOPTIMIZE '(' aSTRING ')' { $$ = attr_ptr( ATTR_OPTIMIZE, $3 ); }
| tOPTIONAL { $$ = attr_int( ATTR_OPTIONAL, 0 ); }
| tOUT { $$ = attr_int( ATTR_OUT, 0 ); }
| tOVERLOAD '(' aSTRING ')' { $$ = attr_ptr( ATTR_OVERLOAD, $3 ); }
| tPARTIALIGNORE { $$ = attr_int( ATTR_PARTIALIGNORE, 0 ); }
| tPOINTERDEFAULT '(' pointer_type ')' { $$ = attr_int( ATTR_POINTERDEFAULT, $3 ); }
| tPROGID '(' aSTRING ')' { $$ = attr_ptr( ATTR_PROGID, $3 ); }
| tPROPGET { $$ = attr_int( ATTR_PROPGET, 0 ); }
| tPROPPUT { $$ = attr_int( ATTR_PROPPUT, 0 ); }
| tPROPPUTREF { $$ = attr_int( ATTR_PROPPUTREF, 0 ); }
| tPROXY { $$ = attr_int( ATTR_PROXY, 0 ); }
| tPUBLIC { $$ = attr_int( ATTR_PUBLIC, 0 ); }
| tRANGE '(' expr_int_const ',' expr_int_const ')'
{ expr_list_t *list = append_expr( NULL, $3 );
list = append_expr( list, $5 );
$$ = make_attrp( ATTR_RANGE, list );
$$ = attr_ptr( ATTR_RANGE, list );
}
| tREADONLY { $$ = make_attr( ATTR_READONLY ); }
| tREPRESENTAS '(' type ')' { $$ = make_attrp( ATTR_REPRESENTAS, $3 ); }
| tREQUESTEDIT { $$ = make_attr( ATTR_REQUESTEDIT ); }
| tRESTRICTED { $$ = make_attr( ATTR_RESTRICTED ); }
| tRETVAL { $$ = make_attr( ATTR_RETVAL ); }
| tSIZEIS '(' m_exprs ')' { $$ = make_attrp( ATTR_SIZEIS, $3 ); }
| tSOURCE { $$ = make_attr( ATTR_SOURCE ); }
| tSTATIC '(' static_attr ')' { $$ = make_attrp( ATTR_STATIC, $3 ); }
| tSTRICTCONTEXTHANDLE { $$ = make_attr( ATTR_STRICTCONTEXTHANDLE ); }
| tSTRING { $$ = make_attr( ATTR_STRING ); }
| tSWITCHIS '(' expr ')' { $$ = make_attrp( ATTR_SWITCHIS, $3 ); }
| tSWITCHTYPE '(' type ')' { $$ = make_attrp( ATTR_SWITCHTYPE, $3 ); }
| tTRANSMITAS '(' type ')' { $$ = make_attrp( ATTR_TRANSMITAS, $3 ); }
| tTHREADING '(' threading_type ')' { $$ = make_attrv( ATTR_THREADING, $3 ); }
| tUIDEFAULT { $$ = make_attr( ATTR_UIDEFAULT ); }
| tUSESGETLASTERROR { $$ = make_attr( ATTR_USESGETLASTERROR ); }
| tUSERMARSHAL '(' type ')' { $$ = make_attrp( ATTR_USERMARSHAL, $3 ); }
| tUUID '(' aUUID ')' { $$ = make_attrp( ATTR_UUID, $3 ); }
| tASYNCUUID '(' aUUID ')' { $$ = make_attrp( ATTR_ASYNCUUID, $3 ); }
| tV1ENUM { $$ = make_attr( ATTR_V1ENUM ); }
| tVARARG { $$ = make_attr( ATTR_VARARG ); }
| tVERSION '(' version ')' { $$ = make_attrv( ATTR_VERSION, $3 ); }
| tVIPROGID '(' aSTRING ')' { $$ = make_attrp( ATTR_VIPROGID, $3 ); }
| tWIREMARSHAL '(' type ')' { $$ = make_attrp( ATTR_WIREMARSHAL, $3 ); }
| pointer_type { $$ = make_attrv( ATTR_POINTERTYPE, $1 ); }
| tREADONLY { $$ = attr_int( ATTR_READONLY, 0 ); }
| tREPRESENTAS '(' type ')' { $$ = attr_ptr( ATTR_REPRESENTAS, $3 ); }
| tREQUESTEDIT { $$ = attr_int( ATTR_REQUESTEDIT, 0 ); }
| tRESTRICTED { $$ = attr_int( ATTR_RESTRICTED, 0 ); }
| tRETVAL { $$ = attr_int( ATTR_RETVAL, 0 ); }
| tSIZEIS '(' m_exprs ')' { $$ = attr_ptr( ATTR_SIZEIS, $3 ); }
| tSOURCE { $$ = attr_int( ATTR_SOURCE, 0 ); }
| tSTATIC '(' static_attr ')' { $$ = attr_ptr( ATTR_STATIC, $3 ); }
| tSTRICTCONTEXTHANDLE { $$ = attr_int( ATTR_STRICTCONTEXTHANDLE, 0 ); }
| tSTRING { $$ = attr_int( ATTR_STRING, 0 ); }
| tSWITCHIS '(' expr ')' { $$ = attr_ptr( ATTR_SWITCHIS, $3 ); }
| tSWITCHTYPE '(' type ')' { $$ = attr_ptr( ATTR_SWITCHTYPE, $3 ); }
| tTRANSMITAS '(' type ')' { $$ = attr_ptr( ATTR_TRANSMITAS, $3 ); }
| tTHREADING '(' threading_type ')' { $$ = attr_int( ATTR_THREADING, $3 ); }
| tUIDEFAULT { $$ = attr_int( ATTR_UIDEFAULT, 0 ); }
| tUSESGETLASTERROR { $$ = attr_int( ATTR_USESGETLASTERROR, 0 ); }
| tUSERMARSHAL '(' type ')' { $$ = attr_ptr( ATTR_USERMARSHAL, $3 ); }
| tUUID '(' aUUID ')' { $$ = attr_ptr( ATTR_UUID, $3 ); }
| tASYNCUUID '(' aUUID ')' { $$ = attr_ptr( ATTR_ASYNCUUID, $3 ); }
| tV1ENUM { $$ = attr_int( ATTR_V1ENUM, 0 ); }
| tVARARG { $$ = attr_int( ATTR_VARARG, 0 ); }
| tVERSION '(' version ')' { $$ = attr_int( ATTR_VERSION, $3 ); }
| tVIPROGID '(' aSTRING ')' { $$ = attr_ptr( ATTR_VIPROGID, $3 ); }
| tWIREMARSHAL '(' type ')' { $$ = attr_ptr( ATTR_WIREMARSHAL, $3 ); }
| pointer_type { $$ = attr_int( ATTR_POINTERTYPE, $1 ); }
;
callconv: tCDECL
......@@ -739,11 +739,11 @@ cases
| cases case { $$ = append_var( $1, $2 ); }
;
case : tCASE expr_int_const ':' union_field { attr_t *a = make_attrp( ATTR_CASE, append_expr( NULL, $2 ) );
case : tCASE expr_int_const ':' union_field { attr_t *a = attr_ptr( ATTR_CASE, append_expr( NULL, $2 ) );
$$ = $4; if (!$$) $$ = make_var( NULL );
$$->attrs = append_attr( $$->attrs, a );
}
| tDEFAULT ':' union_field { attr_t *a = make_attr( ATTR_DEFAULT );
| tDEFAULT ':' union_field { attr_t *a = attr_int( ATTR_DEFAULT, 0 );
$$ = $3; if (!$$) $$ = make_var( NULL );
$$->attrs = append_attr( $$->attrs, a );
}
......@@ -1028,7 +1028,7 @@ class_interface:
dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); }
;
dispattributes: attributes { $$ = append_attr( $1, make_attr( ATTR_DISPINTERFACE ) ); }
dispattributes: attributes { $$ = append_attr( $1, attr_int( ATTR_DISPINTERFACE, 0 ) ); }
;
dispint_props: tPROPERTIES ':' { $$ = NULL; }
......@@ -1375,10 +1375,10 @@ acf_attribute_list
acf_attribute
: tALLOCATE '(' allocate_option_list ')'
{ $$ = make_attrv( ATTR_ALLOCATE, $3 ); }
| tENCODE { $$ = make_attr( ATTR_ENCODE ); }
| tDECODE { $$ = make_attr( ATTR_DECODE ); }
| tEXPLICITHANDLE { $$ = make_attr( ATTR_EXPLICIT_HANDLE ); }
{ $$ = attr_int( ATTR_ALLOCATE, $3 ); }
| tENCODE { $$ = attr_int( ATTR_ENCODE, 0 ); }
| tDECODE { $$ = attr_int( ATTR_DECODE, 0 ); }
| tEXPLICITHANDLE { $$ = attr_int( ATTR_EXPLICIT_HANDLE, 0 ); }
;
allocate_option_list
......@@ -1638,7 +1638,7 @@ static void append_chain_callconv(type_t *chain, char *callconv)
type_t *chain_end;
if (chain && (chain_end = get_chain_end(chain)))
chain_end->attrs = append_attr(chain_end->attrs, make_attrp(ATTR_CALLCONV, callconv));
chain_end->attrs = append_attr( chain_end->attrs, attr_ptr( ATTR_CALLCONV, callconv ) );
else
error_loc("calling convention applied to non-function type\n");
}
......@@ -2065,7 +2065,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
type_t *type = decl_spec->type;
if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC))
attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
attrs = append_attr( attrs, attr_int( ATTR_PUBLIC, 0 ) );
/* We must generate names for tagless enum, struct or union.
Typedef-ing a tagless enum, struct or union means we want the typedef
......@@ -2079,7 +2079,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
{
type->name = gen_name();
if (!is_attr(attrs, ATTR_PUBLIC))
attrs = append_attr(attrs, make_attr(ATTR_PUBLIC));
attrs = append_attr( attrs, attr_int( ATTR_PUBLIC, 0 ) );
}
/* replace existing attributes when generating a typelib */
......@@ -2580,7 +2580,7 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
* "[in] handle_t IDL_handle" as the first parameter to the
* function */
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
idl_handle->attrs = append_attr( NULL, attr_int( ATTR_IN, 0 ) );
idl_handle->declspec.type = find_type_or_error(NULL, "handle_t");
type_function_add_head_arg(func->declspec.type, idl_handle);
}
......@@ -2636,7 +2636,7 @@ static int async_iface_attrs(attr_list_t *attrs, const attr_t *attr)
case ATTR_UUID:
return 0;
case ATTR_ASYNCUUID:
append_attr(attrs, make_attrp(ATTR_UUID, attr->u.pval));
append_attr( attrs, attr_ptr( ATTR_UUID, attr->u.pval ) );
return 0;
default:
return 1;
......
......@@ -1268,7 +1268,7 @@ static void compute_interface_signature_uuid(type_t *iface)
if (!(uuid = get_attrp(iface->attrs, ATTR_UUID)))
{
uuid = xmalloc(sizeof(*uuid));
iface->attrs = append_attr(iface->attrs, make_attrp(ATTR_UUID, uuid));
iface->attrs = append_attr( iface->attrs, attr_ptr( ATTR_UUID, uuid ) );
}
sha1_init(&ctx);
......
......@@ -97,9 +97,8 @@ extern void end_cplusplus_guard(FILE *fp);
/* attribute.c */
extern attr_t *make_attr( enum attr_type attr_type );
extern attr_t *make_attrv( enum attr_type attr_type, unsigned int val );
extern attr_t *make_attrp( enum attr_type attr_type, void *val );
extern attr_t *attr_int( enum attr_type attr_type, unsigned int val );
extern attr_t *attr_ptr( enum attr_type attr_type, void *val );
extern attr_t *make_custom_attr( struct uuid *id, expr_t *pval );
extern int is_attr( const attr_list_t *list, enum attr_type attr_type );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment