diff options
author | Andreas Schneider <asn@samba.org> | 2017-07-26 16:33:10 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-03-01 04:37:41 +0100 |
commit | 05dae361b388e71701a7c646f2787315e9bd5dfb (patch) | |
tree | 8be6758b1fbec343b3e8eb0f6a39f873d9c804f4 /lib/replace/wscript | |
parent | 76535df3248b7f4e489d1555f27cedd151cd1a50 (diff) | |
download | samba-05dae361b388e71701a7c646f2787315e9bd5dfb.tar.gz |
lib:replace: Add FALL_THROUGH support
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/replace/wscript')
-rw-r--r-- | lib/replace/wscript | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/replace/wscript b/lib/replace/wscript index a2e2d118477..534062ec717 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -249,6 +249,42 @@ def configure(conf): headers='stdint.h sys/atomic.h', msg='Checking for atomic_add_32 compiler builtin') + conf.CHECK_CODE(''' + #define FALL_THROUGH __attribute__((fallthrough)) + + enum direction_e { + UP = 0, + DOWN, + }; + + int main(void) { + enum direction_e key = UP; + int i = 10; + int j = 0; + + switch (key) { + case UP: + i = 5; + FALL_THROUGH; + case DOWN: + j = i * 2; + break; + default: + break; + } + + if (j < i) { + return 1; + } + + return 0; + } + ''', + 'HAVE_FALLTHROUGH_ATTRIBUTE', + addmain=False, + cflags='-Werror', + msg='Checking for fallthrough attribute') + # these may be builtins, so we need the link=False strategy conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False) |