]> andersk Git - splint.git/blobdiff - src/cgrammar.y
Extended grammar to support designators in initializers.
[splint.git] / src / cgrammar.y
index 993d8e65a3c27b7697677be0570cdcf92e86dd3a..98ad6f26bcd17c5b7e9504f37acc0b074509c807 100644 (file)
@@ -309,6 +309,8 @@ extern void yyerror (char *);
 %type <expr> stmtErr stmtListErr compoundStmtErr expressionStmtErr 
 %type <expr> iterationStmtErr initializerList initializer ifPred whilePred forPred iterWhilePred
 
+%type <expr> designator designatorList designation
+
 %type <typequal> storageSpecifier typeQualifier typeModifier globQual
 %type <tquallist> optGlobQuals
 %type <qtyp> completeType completeTypeSpecifier optCompleteType
@@ -1018,7 +1020,24 @@ init
  : assignExpr                      
  | TLBRACE initList TRBRACE        { $$ = exprNode_makeInitBlock ($1, $2); }
  | TLBRACE initList TCOMMA TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); }
+ | designation init                { $$ = exprNode_undefined; }
+
+/*
+** Splint parses these (added in ISO C99), but no checking yet...
+*/
+
+designation
+ : designatorList TASSIGN          { $$ = $1; }
+ | newId TCOLON                    { $$ = exprNode_undefined; 
+                                     /* gcc extension, obsolete since 2.5 */ }
+
+designatorList
+ : designator                      { $$ = exprNode_undefined; } 
+ | designatorList designator       { $$ = exprNode_undefined; }
 
+designator
+ : TLSQBR constantExpr TRSQBR      { $$ = exprNode_undefined; }
+ | TDOT newId                      { $$ = exprNode_undefined; }
 
 initList
  : init 
This page took 0.033118 seconds and 4 git commands to generate.