]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: wrap "fallthrough" attr 2883/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 15 Aug 2018 03:49:29 +0000 (05:49 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 21 Aug 2018 18:34:58 +0000 (20:34 +0200)
This generates a warning on gcc versions before 7.0.

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/compiler.h
tests/bgpd/test_capability.c

index b19c33f65e6b3de860ae46f58e791429c67b4c65..24b8fafd108a29a40e96688fcf7198ecc865be33 100644 (file)
@@ -24,6 +24,9 @@
 #if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5)
 #  define _RET_NONNULL    , returns_nonnull
 #endif
+#if __has_attribute(fallthrough)
+#  define _FALLTHROUGH __attribute__((fallthrough));
+#endif
 # define _CONSTRUCTOR(x)  constructor(x)
 #elif defined(__GNUC__)
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
@@ -34,6 +37,9 @@
 #  define _DESTRUCTOR(x)  destructor(x)
 #  define _ALLOC_SIZE(x)  alloc_size(x)
 #endif
+#if __GNUC__ >= 7
+#  define _FALLTHROUGH __attribute__((fallthrough));
+#endif
 #endif
 
 #ifdef __sun
@@ -55,6 +61,9 @@
 #ifndef _ALLOC_SIZE
 # define _ALLOC_SIZE(x)
 #endif
+#ifndef _FALLTHROUGH
+#define _FALLTHROUGH
+#endif
 
 /*
  * for warnings on macros, put in the macro content like this:
index 4612bdc26b0adc737e792c74c2255639153433a0..fef7d39ff5904923733dbcc45c26c16d5d977cbc 100644 (file)
@@ -821,7 +821,7 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type)
        switch (type) {
        case CAPABILITY:
                len += 2; /* to cover the OPT-Param header */
-               __attribute__ ((fallthrough));
+               _FALLTHROUGH
        case OPT_PARAM:
                printf("len: %u\n", len);
                /* peek_for_as4 wants getp at capibility*/