}
if (!vec_size(items)) {
- FILE *src;
- char *line;
+ FILE *src;
+ char *line = NULL;
size_t linelen = 0;
+ bool hasline = false;
progs_src = true;
goto cleanup;
}
- line = NULL;
- if (!progs_nextline(&line, &linelen, src) || !line[0]) {
- con_err("illformatted progs.src file: expected output filename in first line\n");
- retval = 1;
- goto srcdone;
- }
-
- if (!opts_output_wasset) {
- OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line);
- opts_output_free = true;
- }
-
while (progs_nextline(&line, &linelen, src)) {
argitem item;
+
if (!line[0] || (line[0] == '/' && line[1] == '/'))
continue;
- item.filename = util_strdup(line);
- item.type = TYPE_QC;
- vec_push(items, item);
+
+ if (hasline) {
+ item.filename = util_strdup(line);
+ item.type = TYPE_QC;
+ vec_push(items, item);
+ } else if (!opts_output_wasset) {
+ OPTS_OPTION_STR(OPTION_OUTPUT) = util_strdup(line);
+ opts_output_free = true;
+ hasline = true;
+ }
}
-srcdone:
fs_file_close(src);
mem_d(line);
}
GMQCC_DEFINE_FLAG(DIFFERENT_ATTRIBUTES)
GMQCC_DEFINE_FLAG(DEPRECATED)
GMQCC_DEFINE_FLAG(PARENTHESIS)
+ GMQCC_DEFINE_FLAG(BREAKDEF)
#endif
#ifdef GMQCC_TYPE_OPTIMIZATIONS
if (parser->tok != '{' || var->expression.vtype != TYPE_FUNCTION) {
if (parser->tok != '=') {
- parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
- break;
+ if (!strcmp(parser_tokval(parser), "break")) {
+ if (!parser_next(parser)) {
+ parseerror(parser, "error parsing break definition");
+ break;
+ }
+ (void)!!parsewarning(parser, WARN_BREAKDEF, "break definition ignored (suggest removing it)");
+ } else {
+ parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
+ break;
+ }
}
if (!parser_next(parser)) {