Apparently clang does need the pragmas, so either I tested it
incorrectly before, or my local clang is different. It looks like
clang doesn't ignore the pragmas as far as the expression result value
is concerned, so explicitly put the value at the end.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
#endif
-#ifdef __clang__
-#define INTEGRAL_ASSIGNMENT_FITS(dest, src) \
- ({ \
- *(dest) = (src); \
- *(dest) == (src) && (*(dest) < 1) == ((src) < 1); \
- })
-#else
// Disabling sign-compare here should be fine since we're explicitly
// checking for a sign mismatch, i.e. if the signs don't match, then
// it doesn't matter what the value comparison says.
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wsign-compare\""); \
*(dest) = (src); \
- *(dest) == (src) && (*(dest) < 1) == ((src) < 1); \
+ int result = *(dest) == (src) && (*(dest) < 1) == ((src) < 1); \
_Pragma("GCC diagnostic pop"); \
+ result; \
})
-#endif
// At the moment any code that calls INTEGER_TO_PY() will have to