mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04: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:
@@ -311,6 +311,13 @@ size_t strnlen(const char *s, size_t maxlen);
|
|||||||
# define pure_func
|
# define pure_func
|
||||||
#endif
|
#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 */
|
/* Watcom doesn't handle switch statements with 64-bit types, hack around it */
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
# define BOGUS_CASE 0x76543210
|
# define BOGUS_CASE 0x76543210
|
||||||
|
Reference in New Issue
Block a user