mirror of
https://github.com/netwide-assembler/nasm
synced 2026-08-26 16:23:04 -04:00
asm/error.c: handle -w* during command line parsing
During command line parsing, warning_state_init is NULL as the warning stack is naturally not set up yet. Furthermore, -w* would mean return to command-line default, which isn't even defined yet. Rather than ignoring it or returning an error, do something useful by allowing -w* to reset to the *compile time* default when specified on the command line. Reported-by: <momo-trip@github.com> Fixes: https://github.com/netwide-assembler/nasm/issues/155 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
63abf28933
commit
9248a85f97
1 changed files with 9 additions and 1 deletions
10
asm/error.c
10
asm/error.c
|
|
@ -214,11 +214,19 @@ bool set_warning_status(const char *value)
|
|||
warning_state[i] |= mask;
|
||||
break;
|
||||
case WID_RESET:
|
||||
{
|
||||
uint8_t old;
|
||||
if (warning_state_init)
|
||||
old = warning_state_init->state[i];
|
||||
else
|
||||
old = warning_default[i];
|
||||
|
||||
warning_state[i] &= ~mask;
|
||||
warning_state[i] |= warning_state_init->state[i] & mask;
|
||||
warning_state[i] |= old & mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok && value) {
|
||||
nasm_warn(WARN_UNKNOWN_WARNING, "unknown warning name: %s", value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue