mirror of
https://github.com/netwide-assembler/nasm
synced 2026-08-26 16:23:04 -04:00
nasm_build_assert() -> nasm_static_assert()
The C11 standard calls this concept a static assert, so go with that terminology. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
4eb7a1f089
commit
94e4052a8a
2 changed files with 4 additions and 4 deletions
|
|
@ -176,9 +176,9 @@ no_return nasm_assert_failed(const char *, int, const char *);
|
|||
* NASM failure at build time if the argument is false
|
||||
*/
|
||||
#ifdef static_assert
|
||||
# define nasm_build_assert(x) static_assert(x, #x)
|
||||
# define nasm_static_assert(x) static_assert(x, #x)
|
||||
#elif defined(HAVE_FUNC_ATTRIBUTE_ERROR) && defined(__OPTIMIZE__)
|
||||
# define nasm_build_assert(x) \
|
||||
# define nasm_static_assert(x) \
|
||||
if (!(x)) { \
|
||||
extern void __attribute__((error("assertion " #x " failed"))) \
|
||||
_nasm_static_fail(void); \
|
||||
|
|
@ -186,7 +186,7 @@ no_return nasm_assert_failed(const char *, int, const char *);
|
|||
}
|
||||
#else
|
||||
/* See http://www.drdobbs.com/compile-time-assertions/184401873 */
|
||||
# define nasm_build_assert(x) \
|
||||
# define nasm_static_assert(x) \
|
||||
do { enum { _static_assert_failed = 1/(!!(x)) }; } while (0)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue