STACK_DCL(blockNum,int,MAX_NEST_LEVEL*3)
value *cenum = NULL ; /* current enumeration type chain*/
+bool uselessDecl = TRUE;
%}
%expect 6
;
declaration
- : declaration_specifiers ';' { $$ = NULL ; }
+ : declaration_specifiers ';'
+ {
+ if (uselessDecl)
+ werror(W_USELESS_DECL);
+ uselessDecl = TRUE;
+ $$ = NULL ;
+ }
| declaration_specifiers init_declarator_list ';'
{
/* add the specifier list to the id */
addDecl (sym,0,lnk) ;
}
+ uselessDecl = TRUE;
$$ = sym1 ;
}
;
SPEC_BSTR($$) = 0;
}
- | struct_or_union_specifier
+ | struct_or_union_specifier {
+ uselessDecl = FALSE;
+ $$ = $1 ;
+ }
| enum_specifier {
cenum = NULL ;
+ uselessDecl = FALSE;
$$ = $1 ;
}
| TYPE_NAME