diff options
author | H. Peter Anvin (Intel) <hpa@zytor.com> | 2018-12-14 14:21:16 -0800 |
---|---|---|
committer | H. Peter Anvin (Intel) <hpa@zytor.com> | 2018-12-14 15:42:03 -0800 |
commit | b7f24e7715d8fdca52fda7fb9df1b70d8d4bbc6b (patch) | |
tree | 15669a93ec7bc21743b0928d04b7861180082cb6 /output | |
parent | c3c6cea83804e7ba36b31d15ba25954ea3a5bdfd (diff) | |
download | nasm-b7f24e7715d8fdca52fda7fb9df1b70d8d4bbc6b.tar.gz |
nasm_assert(): try to run at compile time if possible
Try to make nasm_assert() do a static assert if the argument can be
evaluated at compile time by any particular compiler. We also provide
nasm_try_static_assert() which will assert a compile-time expression
if and only if we can determine we have a constant at compile time
*and* we know that the compiler has a way to handle it.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'output')
-rw-r--r-- | output/codeview.c | 4 | ||||
-rw-r--r-- | output/outbin.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/output/codeview.c b/output/codeview.c index 6028fc74..03fee590 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -654,7 +654,7 @@ static uint16_t write_symbolinfo_properties(struct coff_Section *sect, else if (win32) section_write16(sect, 0x0006); /* machine */ else - nasm_assert(!"neither win32 nor win64 are set!"); + nasm_panic("neither win32 nor win64 are set!"); section_write16(sect, 0); /* verFEMajor */ section_write16(sect, 0); /* verFEMinor */ section_write16(sect, 0); /* verFEBuild */ @@ -711,7 +711,7 @@ static uint16_t write_symbolinfo_symbols(struct coff_Section *sect) section_write8(sect, 0); /* FLAG */ break; default: - nasm_assert(!"unknown symbol type"); + nasm_panic("unknown symbol type"); } section_wbytes(sect, sym->name, strlen(sym->name) + 1); diff --git a/output/outbin.c b/output/outbin.c index 971b9cc0..5e0dbdbc 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -1507,7 +1507,7 @@ static void write_srecord(unsigned int len, unsigned int alen, case 4: break; default: - nasm_assert(0); + panic(); break; } |