]> arthur.barton.de Git - bup.git/commitdiff
INTEGRAL_ASSIGNMENT_FITS: actually provide return value for clang
authorRob Browning <rlb@defaultvalue.org>
Tue, 31 Dec 2019 18:19:39 +0000 (12:19 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 2 Feb 2020 18:15:09 +0000 (12:15 -0600)
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>
lib/bup/_helpers.c

index b29c54cb782e16882d5043149c88423b37c980e9..d325578fcace65d16bf554d53b0b682c2ce95ea1 100644 (file)
@@ -129,13 +129,6 @@ static uint64_t htonll(uint64_t value)
 #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.
@@ -145,10 +138,10 @@ static uint64_t htonll(uint64_t value)
         _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