BR 560960: warn about trailing garbage in %macro/%ifmacro

This commit is contained in:
Victor van den Elzen 2008-07-23 15:14:22 +02:00
parent 0e857f1fe5
commit b916edecf4

View File

@ -1647,6 +1647,8 @@ static bool if_condition(Token * tline, enum preproc_token ct)
}
mmac = mmac->next;
}
if(tline && tline->next)
error(ERR_WARNING, "trailing garbage after %%ifmacro ignored");
nasm_free(searching.name);
j = found;
break;
@ -1817,16 +1819,19 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive)
error(ERR_NONFATAL, "`%s' expects a macro name", directive);
return false;
}
def->name = nasm_strdup(tline->text);
def->plus = false;
def->nolist = false;
def->in_progress = 0;
def->rep_nest = NULL;
def->nparam_min = 0;
def->nparam_max = 0;
tline = expand_smacro(tline->next);
skip_white_(tline);
if (!tok_type_(tline, TOK_NUMBER)) {
error(ERR_NONFATAL, "`%s' expects a parameter count", directive);
def->nparam_min = def->nparam_max = 0;
} else {
def->nparam_min = def->nparam_max =
readnum(tline->text, &err);
@ -1875,6 +1880,9 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive)
}
def->expansion = NULL;
if(def->defaults && def->ndefs > def->nparam_max - def->nparam_min)
error(ERR_WARNING, "too much default macro parameters");
return true;
}