mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 02:40:56 +00:00
-Wuninitialized-const, -Wuninitialized-global
This commit is contained in:
parent
dae1291b37
commit
47baca22d9
3 changed files with 11 additions and 0 deletions
1
opts.c
1
opts.c
|
@ -55,6 +55,7 @@ static void opts_setdefault() {
|
|||
opts_set(opts.warn, WARN_CPP, true);
|
||||
opts_set(opts.warn, WARN_UNKNOWN_ATTRIBUTE, true);
|
||||
opts_set(opts.warn, WARN_RESERVED_NAMES, true);
|
||||
opts_set(opts.warn, WARN_UNINITIALIZED_CONSTANT, true);
|
||||
/* flags */
|
||||
opts_set(opts.flags, ADJUST_VECTOR_FIELDS, true);
|
||||
opts_set(opts.flags, FTEPP, false);
|
||||
|
|
2
opts.def
2
opts.def
|
@ -80,6 +80,8 @@
|
|||
GMQCC_DEFINE_FLAG(CPP)
|
||||
GMQCC_DEFINE_FLAG(UNKNOWN_ATTRIBUTE)
|
||||
GMQCC_DEFINE_FLAG(RESERVED_NAMES)
|
||||
GMQCC_DEFINE_FLAG(UNINITIALIZED_CONSTANT)
|
||||
GMQCC_DEFINE_FLAG(UNINITIALIZED_GLOBAL)
|
||||
#endif
|
||||
|
||||
#ifdef GMQCC_TYPE_OPTIMIZATIONS
|
||||
|
|
8
parser.c
8
parser.c
|
@ -5145,6 +5145,14 @@ bool parser_finish(const char *output)
|
|||
if (!ast_istype(parser->globals[i], ast_value))
|
||||
continue;
|
||||
asvalue = (ast_value*)(parser->globals[i]);
|
||||
if (asvalue->cvq == CV_CONST && !asvalue->hasvalue)
|
||||
(void)!compile_warning(ast_ctx(asvalue), WARN_UNINITIALIZED_CONSTANT,
|
||||
"uninitialized constant: `%s`",
|
||||
asvalue->name);
|
||||
else if ((asvalue->cvq == CV_NONE || asvalue->cvq == CV_CONST) && !asvalue->hasvalue)
|
||||
(void)!compile_warning(ast_ctx(asvalue), WARN_UNINITIALIZED_GLOBAL,
|
||||
"uninitialized global: `%s`",
|
||||
asvalue->name);
|
||||
if (!ast_generate_accessors(asvalue, ir)) {
|
||||
ir_builder_delete(ir);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue