mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-11-08 23:27:15 -05:00
compiler: add and use unreachable() macro
C23 defines unreachable() as a macro in <stddef.h>. For earlier versions of gcc, __builtin_unreachable() is possible. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
@@ -469,4 +469,12 @@ static inline unsigned int watcom_switch_hack(uint64_t x)
|
||||
# define default case BOGUS_CASE: default
|
||||
#endif
|
||||
|
||||
#ifndef unreachable /* C23 defines as a macro in <stddef.h> */
|
||||
# ifdef HAVE___BUILTIN_UNREACHABLE
|
||||
# define unreachable() __builtin_unreachable()
|
||||
# else
|
||||
# define unreachable() do { abort(); } while(1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* NASM_COMPILER_H */
|
||||
|
||||
Reference in New Issue
Block a user