mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 22:22:17 +00:00
-Wconst-var
This commit is contained in:
parent
93ae1a65fb
commit
4b619ce1cd
2 changed files with 8 additions and 0 deletions
1
opts.def
1
opts.def
|
@ -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 */
|
||||
|
|
7
parser.c
7
parser.c
|
@ -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")) {
|
||||
|
|
Loading…
Reference in a new issue