options_set(opts_warn, WARN_FRAME_MACROS, true);
options_set(opts_warn, WARN_UNUSED_VARIABLE, true);
options_set(opts_warn, WARN_EFFECTLESS_STATEMENT, true);
+ options_set(opts_warn, WARN_END_SYS_FIELDS, true);
if (!options_parse(argc, argv)) {
return usage();
ast_value *imm_float_zero;
ast_value *imm_vector_zero;
+ size_t crc_globals;
+ size_t crc_fields;
+
ast_function *function;
MEM_VECTOR_MAKE(varentry_t, locals);
size_t blocklocal;
goto cleanup;
}
+ if (!localblock) {
+ if (!strcmp(parser_tokval(parser), "end_sys_globals"))
+ parser->crc_globals = parser->globals_count;
+ else if (!strcmp(parser_tokval(parser), "end_sys_fields"))
+ parser->crc_fields = parser->fields_count;
+ }
+
if (!isfunc) {
if (!localblock && (olddecl = parser_find_global(parser, parser_tokval(parser)))) {
parseerror(parser, "global `%s` already declared here: %s:%i",
var = fval;
}
+ if (!strcmp(parser_tokval(parser), "end_sys_fields")) {
+ if (parsewarning(parser, WARN_END_SYS_FIELDS, "by convention end_sys_fields should be declared as global, rather than a field")) {
+ ast_value_delete(var);
+ return false;
+ }
+ }
+
/* turn it into a field */
fld = ast_value_new(ctx, parser_tokval(parser), TYPE_FIELD);
fld->expression.next = (ast_expression*)var;
GMQCC_DEFINE_FLAG(VARIADIC_FUNCTION)
GMQCC_DEFINE_FLAG(FRAME_MACROS)
GMQCC_DEFINE_FLAG(EFFECTLESS_STATEMENT)
+GMQCC_DEFINE_FLAG(END_SYS_FIELDS)