mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-23 17:29:23 +08:00
compiler.h: add is_constant()
Add macro is_constant() to return true if and only if the value is a compile-time constant. It may never return true, however. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
e5033dfd1c
commit
cb7da7e7f6
@ -311,6 +311,13 @@ size_t strnlen(const char *s, size_t maxlen);
|
||||
# define pure_func
|
||||
#endif
|
||||
|
||||
/* Determine probabilistically if something is a compile-time constant */
|
||||
#ifdef HAVE__BUILTIN_CONSTANT_P
|
||||
# define is_constant(x) __builtin_constant_p(x)
|
||||
#else
|
||||
# define is_constant(x) false
|
||||
#endif
|
||||
|
||||
/* Watcom doesn't handle switch statements with 64-bit types, hack around it */
|
||||
#ifdef __WATCOMC__
|
||||
# define BOGUS_CASE 0x76543210
|
||||
|
Loading…
Reference in New Issue
Block a user