mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-22 10:41:43 +00:00
Fix some bugs
This commit is contained in:
parent
7115176c0e
commit
23cb7f4e09
3 changed files with 25 additions and 20 deletions
32
main.c
32
main.c
|
@ -662,9 +662,10 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (!vec_size(items)) {
|
||||
FILE *src;
|
||||
char *line;
|
||||
FILE *src;
|
||||
char *line = NULL;
|
||||
size_t linelen = 0;
|
||||
bool hasline = false;
|
||||
|
||||
progs_src = true;
|
||||
|
||||
|
@ -675,28 +676,23 @@ int main(int argc, char **argv) {
|
|||
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);
|
||||
}
|
||||
|
|
1
opts.def
1
opts.def
|
@ -89,6 +89,7 @@
|
|||
GMQCC_DEFINE_FLAG(DIFFERENT_ATTRIBUTES)
|
||||
GMQCC_DEFINE_FLAG(DEPRECATED)
|
||||
GMQCC_DEFINE_FLAG(PARENTHESIS)
|
||||
GMQCC_DEFINE_FLAG(BREAKDEF)
|
||||
#endif
|
||||
|
||||
#ifdef GMQCC_TYPE_OPTIMIZATIONS
|
||||
|
|
12
parser.c
12
parser.c
|
@ -5694,8 +5694,16 @@ skipvar:
|
|||
|
||||
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)) {
|
||||
|
|
Loading…
Reference in a new issue