Commit 118df55b authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

[buddy] workaround newer clang warning

It seems clang now warn about fallthrough case statements in C, but
ignore any /* fall through */ comment if that comes from a macro.

* src/bddop.c: Use the fallthrough attribute if available.
parent 82d69241
Pipeline #18501 canceled with stage
in 50 minutes and 53 seconds
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
#include "kernel.h" #include "kernel.h"
#include "cache.h" #include "cache.h"
#ifdef __has_attribute
# if __has_attribute(fallthrough)
# define BUDDY_FALLTHROUGH __attribute__ ((fallthrough))
# endif
#endif
#ifndef BUDDY_FALLTHROUGH
# define BUDDY_FALLTHROUGH while (0);
#endif
/* Hash value modifiers to distinguish between entries in misccache */ /* Hash value modifiers to distinguish between entries in misccache */
#define CACHEID_CONSTRAIN 0x0 #define CACHEID_CONSTRAIN 0x0
#define CACHEID_RESTRICT 0x1 #define CACHEID_RESTRICT 0x1
...@@ -640,7 +649,7 @@ static BDD apply_rec(BDD l, BDD r) ...@@ -640,7 +649,7 @@ static BDD apply_rec(BDD l, BDD r)
r = tmp; \ r = tmp; \
op = bddop_imp; \ op = bddop_imp; \
} \ } \
/* fall through */ \ BUDDY_FALLTHROUGH; \
case bddop_imp: \ case bddop_imp: \
if (ISONE(r) || ISZERO(l)) \ if (ISONE(r) || ISZERO(l)) \
return 1; \ return 1; \
...@@ -666,7 +675,7 @@ static BDD apply_rec(BDD l, BDD r) ...@@ -666,7 +675,7 @@ static BDD apply_rec(BDD l, BDD r)
r = tmp; \ r = tmp; \
op = bddop_diff; \ op = bddop_diff; \
} \ } \
/* fall through */ \ BUDDY_FALLTHROUGH; \
case bddop_diff: /* l - r = l &! r */ \ case bddop_diff: /* l - r = l &! r */ \
if (l == r || ISONE(r)) \ if (l == r || ISONE(r)) \
return 0; \ return 0; \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment