X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/74738c0fa6a63f888fa6fb0758c9ad438d47a700..f9264521e093e570a8831d5238ccc3bc20e01119:/src/cgrammar.y?ds=sidebyside diff --git a/src/cgrammar.y b/src/cgrammar.y index 039d318..4a08b45 100644 --- a/src/cgrammar.y +++ b/src/cgrammar.y @@ -94,7 +94,7 @@ extern void yyerror (char *); /*@only@*/ modifiesClause modsclause; /*@only@*/ warnClause warnclause; /*@only@*/ stateClause stateclause; - + /*@only@*/ pointers pointers; /*@only@*/ functionConstraint fcnconstraint; /*@only@*/ metaStateConstraint msconstraint; @@ -183,7 +183,7 @@ extern void yyerror (char *); %token QNOTREACHED /* type qualifiers: */ -%token QCONST QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER +%token QCONST QRESTRICT QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER %token QOUT QIN QYIELD QONLY QTEMP QSHARED QREF QUNIQUE %token QCHECKED QUNCHECKED QCHECKEDSTRICT QCHECKMOD %token QKEEP QKEPT QPARTIAL QSPECIAL QOWNED QDEPENDENT @@ -237,7 +237,7 @@ extern void yyerror (char *); %token METASTATE_NAME %type metaStateName %type enumerator newId /*@-varuse@*/ /* yacc declares yytranslate here */ -%type pointers /*@=varuse@*/ +%type pointers /*@=varuse@*/ %type doHeader stateTag conditionTag startConditionClause %type exitsQualifier checkQualifier stateQualifier @@ -312,8 +312,8 @@ extern void yyerror (char *); %type designator designatorList designation -%type storageSpecifier typeQualifier typeModifier globQual -%type optGlobQuals +%type storageSpecifier typeQualifier typeModifier globQual innerMods +%type optGlobQuals innerModsList %type completeType completeTypeSpecifier optCompleteType %type completeTypeSpecifierAux altType typeExpression @@ -961,8 +961,8 @@ initializer instanceDecl : completeTypeSpecifier IsType TSEMI - { $$ = exprNode_makeError (); } - /* + { $$ = exprNode_makeError (); } + /* ** This causes r/r conflicts with function definitions. ** Instead we need to snarf one first. (gack) ** @@ -1213,6 +1213,7 @@ definedQualifier typeQualifier : QCONST IsType { $$ = qual_createConst (); } | QVOLATILE IsType { $$ = qual_createVolatile (); } + | QRESTRICT IsType { $$ = qual_createRestrict (); } | definedQualifier IsType { $$ = $1; } | stateQualifier IsType { $$ = $1; } | exitsQualifier IsType { $$ = $1; } @@ -1365,7 +1366,6 @@ optNamedDecl | pointers TYPE_NAME { qtype qt = qtype_unknown (); - qtype_adjustPointers ($1, qt); $$ = idDecl_create (cstring_copy (LastIdentifier ()), qt); } @@ -1382,18 +1382,19 @@ genericParamList | NotType paramIdList { $$ = handleParamIdList ($2); } innerMods - : QCONST { /* ignored for now */; } - | QVOLATILE { ; } + : QCONST { $$ = qual_createConst (); } + | QRESTRICT { $$ = qual_createRestrict (); } + | QVOLATILE { $$ = qual_createVolatile (); } innerModsList - : innerMods { ; } - | innerModsList innerMods { ; } + : innerMods { $$ = qualList_single ($1); } + | innerModsList innerMods { $$ = qualList_add ($1, $2); } pointers - : TMULT { $$ = 1; } - | TMULT innerModsList { $$ = 1; } - | TMULT pointers { $$ = 1 + $2; } - | TMULT innerModsList pointers { $$ = 1 + $3; } + : TMULT { $$ = pointers_create ($1); } + | TMULT innerModsList { $$ = pointers_createMods ($1, $2); } + | TMULT pointers { $$ = pointers_extend (pointers_create ($1), $2); } + | TMULT innerModsList pointers { $$ = pointers_extend (pointers_createMods ($1, $2), $3); } paramIdList : idList