-Wconst-var

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-25 15:56:13 +01:00
parent 93ae1a65fb
commit 4b619ce1cd
2 changed files with 8 additions and 0 deletions

View file

@ -59,6 +59,7 @@
GMQCC_DEFINE_FLAG(PREPROCESSOR)
GMQCC_DEFINE_FLAG(MULTIFILE_IF)
GMQCC_DEFINE_FLAG(DOUBLE_DECLARATION)
GMQCC_DEFINE_FLAG(CONST_VAR)
#endif
/* some cleanup so we don't have to */

View file

@ -3871,6 +3871,13 @@ static bool parser_global_statement(parser_t *parser)
parseerror(parser, "expected variable declaration after 'const'");
return false;
}
if (parser->tok == TOKEN_IDENT && !strcmp(parser_tokval(parser), "var")) {
(void)!parsewarning(parser, WARN_CONST_VAR, "ignoring `var` after const qualifier");
if (!parser_next(parser)) {
parseerror(parser, "expected variable declaration after 'const var'");
return false;
}
}
return parse_variable(parser, NULL, true, true, NULL);
}
else if (!strcmp(parser_tokval(parser), "typedef")) {