mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-12 18:40:23 +08:00
compiler.h: watcom_switch_hack() improvements
Avoid type promotion due to ?:, and put in a comment to explain what the heck the purpose is of wrapping default in a macro. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
e3cd70bc46
commit
be01d496d4
@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
* Copyright 2007-2016 The NASM Authors - All Rights Reserved
|
||||
* Copyright 2007-2017 The NASM Authors - All Rights Reserved
|
||||
* See the file AUTHORS included with the NASM distribution for
|
||||
* the specific copyright holders.
|
||||
*
|
||||
@ -261,7 +261,10 @@ static inline unsigned int watcom_switch_hack(uint64_t x)
|
||||
return (unsigned int)x;
|
||||
}
|
||||
|
||||
# define switch(x) switch(sizeof(x) > sizeof(unsigned int) ? watcom_switch_hack(x) : (x))
|
||||
# define switch(x) switch(sizeof(x) > sizeof(unsigned int) \
|
||||
? watcom_switch_hack(x) : (unsigned int)(x))
|
||||
|
||||
/* This is to make sure BOGUS_CASE doesn't conflict with anything real... */
|
||||
# define default case BOGUS_CASE: default
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user