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);
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
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;