]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- For #1110: Test for fallthrough attribute in configure and add
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 23 Jul 2024 07:47:42 +0000 (09:47 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 23 Jul 2024 07:47:42 +0000 (09:47 +0200)
  fallthrough attribute annotations.

16 files changed:
config.h.in
configure
configure.ac
dns64/dns64.c
doc/Changelog
libunbound/libworker.c
services/cache/dns.c
services/rpz.c
sldns/parseutil.c
sldns/wire2str.c
util/data/msgparse.c
util/netevent.c
util/proxy_protocol.c
util/siphash.c
util/storage/lookup3.c
validator/val_secalgo.c

index 88347fe4dcd7d35506bd2c734d2b3f960f7faa16..4a7143c52527064832c3fd2b34831c235962543d 100644 (file)
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* apply the fallthrough attribute. */
+#undef ATTR_FALLTHROUGH
+
 /* apply the noreturn attribute to a function that exits the program */
 #undef ATTR_NORETURN
 
@@ -57,6 +60,9 @@
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
+/* Whether the C compiler accepts the "fallthrough" attribute */
+#undef HAVE_ATTR_FALLTHROUGH
+
 /* Whether the C compiler accepts the "format" attribute */
 #undef HAVE_ATTR_FORMAT
 
index 9dc603045283323ba819b7f69d23aea5e17530a6..9998b36e493a1259af4b093377ffad7f35ad06d9 100755 (executable)
--- a/configure
+++ b/configure
@@ -7026,6 +7026,75 @@ printf "%s\n" "#define ATTR_NORETURN __attribute__((__noreturn__))" >>confdefs.h
 fi
 
 
+
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"fallthrough\" attribute" >&5
+printf %s "checking whether the C compiler (${CC-cc}) accepts the \"fallthrough\" attribute... " >&6; }
+BAKCFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+if test ${ac_cv_c_fallthrough_attribute+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_cv_c_fallthrough_attribute=no
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <stdio.h>
+void f(int x) {
+       int y = 0;
+       switch(x) {
+       case 1:
+               y = 1;
+               __attribute__((fallthrough));
+               /* fallthrough */
+       case 2:
+               y++;
+               break;
+       case 3:
+               y = 3;
+               break;
+       }
+       printf("%d", y);
+}
+
+int
+main (void)
+{
+
+   f(1);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ac_cv_c_fallthrough_attribute="yes"
+else $as_nop
+  ac_cv_c_fallthrough_attribute="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+fi
+
+CFLAGS="$BAKCFLAGS"
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_fallthrough_attribute" >&5
+printf "%s\n" "$ac_cv_c_fallthrough_attribute" >&6; }
+if test $ac_cv_c_fallthrough_attribute = yes; then
+
+printf "%s\n" "#define HAVE_ATTR_FALLTHROUGH 1" >>confdefs.h
+
+
+printf "%s\n" "#define ATTR_FALLTHROUGH __attribute__((fallthrough));" >>confdefs.h
+
+else
+
+printf "%s\n" "#define ATTR_FALLTHROUGH /**/" >>confdefs.h
+
+fi
+
+
 if test "$srcdir" != "."; then
        CPPFLAGS="$CPPFLAGS -I$srcdir"
 fi
index 5597abb880ee40e82a6067b9adf881224fcec526..6adbe0e595956b9c2d6a8e348bb6b60f3c50cee4 100644 (file)
@@ -365,6 +365,47 @@ fi
 
 CHECK_NORETURN_ATTRIBUTE
 
+AC_DEFUN([CHECK_FALLTHROUGH_ATTRIBUTE],
+[AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "fallthrough" attribute)
+BAKCFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+AC_CACHE_VAL(ac_cv_c_fallthrough_attribute,
+[ac_cv_c_fallthrough_attribute=no
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h>
+void f(int x) {
+       int y = 0;
+       switch(x) {
+       case 1:
+               y = 1;
+               __attribute__((fallthrough));
+               /* fallthrough */
+       case 2:
+               y++;
+               break;
+       case 3:
+               y = 3;
+               break;
+       }
+       printf("%d", y);
+}
+]], [[
+   f(1);
+]])],[ac_cv_c_fallthrough_attribute="yes"],[ac_cv_c_fallthrough_attribute="no"])
+])
+CFLAGS="$BAKCFLAGS"
+
+AC_MSG_RESULT($ac_cv_c_fallthrough_attribute)
+if test $ac_cv_c_fallthrough_attribute = yes; then
+  AC_DEFINE(HAVE_ATTR_FALLTHROUGH, 1, [Whether the C compiler accepts the "fallthrough" attribute])
+  AC_DEFINE(ATTR_FALLTHROUGH, [__attribute__((fallthrough));], [apply the fallthrough attribute.])
+else
+  AC_DEFINE(ATTR_FALLTHROUGH,[], [apply the fallthrough attribute.])
+fi
+])dnl End of CHECK_FALLTHROUGH_ATTRIBUTE
+
+CHECK_FALLTHROUGH_ATTRIBUTE
+
 if test "$srcdir" != "."; then
        CPPFLAGS="$CPPFLAGS -I$srcdir"
 fi
index 3a43698a8dcdfa626a35bb56aa575b322105d21f..cfb6ce63e1878bdf66a2153dac4736a44cfcee3c 100644 (file)
@@ -701,6 +701,7 @@ dns64_operate(struct module_qstate* qstate, enum module_ev event, int id,
                        iq->state = DNS64_NEW_QUERY;
                        iq->started_no_cache_store = qstate->no_cache_store;
                        qstate->no_cache_store = 1;
+                       ATTR_FALLTHROUGH
                        /* fallthrough */
                case module_event_pass:
                        qstate->ext_state[id] = handle_event_pass(qstate, id);
index 6bac83a7caebecd858b32cc6badebec2fda1df8c..221e8d02da279dc84013cf21f2dbd45d2d12018c 100644 (file)
@@ -1,6 +1,11 @@
 23 July 2024: Yorgos
        - Fix #1106: ratelimit-below-domain logs the wrong FROM address.
 
+23 July 2024: Wouter
+       - Merge #1110: Make fallthrough explicit for libworker.c.
+       - For #1110: Test for fallthrough attribute in configure and add
+         fallthrough attribute annotations.
+
 19 July 2024: Wouter
        - Add dnstap-sample-rate that logs only 1/N messages, for high volume
          server environments. Thanks Dan Luther.
index 191aa0b278554e34c06385c6985a23e9680e46db..94b644a49b86eb0e55df7cc259725ad8712b1c55 100644 (file)
@@ -292,7 +292,8 @@ libworker_do_cmd(struct libworker* w, uint8_t* msg, uint32_t len)
                        log_err("unknown command for bg worker %d", 
                                (int)context_serial_getcmd(msg, len));
                        /* and fall through to quit */
-                       __attribute__((fallthrough));
+                       ATTR_FALLTHROUGH
+                       /* fallthrough */
                case UB_LIBCMD_QUIT:
                        free(msg);
                        comm_base_exit(w->base);
index 426c4506e584a6994ae081a4de40d5af024a633a..60e79a2e7be4165277e6aa63dc4f5d77289f8d97 100644 (file)
@@ -110,6 +110,7 @@ store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
                        /* no break: also copy key item */
                        /* the line below is matched by gcc regex and silences
                         * the fallthrough warning */
+                       ATTR_FALLTHROUGH
                        /* fallthrough */
                case 1: /* ref updated, item inserted */
                        rep->rrsets[i] = rep->ref[i].key;
index 1223f677107d75a49bffe32c0329266cd43e3d49..d8999a8a55eb8a737df9f25c1a22dda7e541cc17 100644 (file)
@@ -242,10 +242,14 @@ rpz_action_to_localzone_type(enum rpz_action a)
        case RPZ_NODATA_ACTION: return local_zone_always_nodata;
        case RPZ_DROP_ACTION: return local_zone_always_deny;
        case RPZ_PASSTHRU_ACTION: return local_zone_always_transparent;
-       case RPZ_LOCAL_DATA_ACTION:     /* fallthrough */
+       case RPZ_LOCAL_DATA_ACTION:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        case RPZ_CNAME_OVERRIDE_ACTION: return local_zone_redirect;
        case RPZ_TCP_ONLY_ACTION: return local_zone_truncate;
-       case RPZ_INVALID_ACTION: /* fallthrough */
+       case RPZ_INVALID_ACTION:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        default: return local_zone_invalid;
        }
 }
@@ -258,10 +262,14 @@ rpz_action_to_respip_action(enum rpz_action a)
        case RPZ_NODATA_ACTION: return respip_always_nodata;
        case RPZ_DROP_ACTION: return respip_always_deny;
        case RPZ_PASSTHRU_ACTION: return respip_always_transparent;
-       case RPZ_LOCAL_DATA_ACTION: /* fallthrough */
+       case RPZ_LOCAL_DATA_ACTION:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        case RPZ_CNAME_OVERRIDE_ACTION: return respip_redirect;
        case RPZ_TCP_ONLY_ACTION: return respip_truncate;
-       case RPZ_INVALID_ACTION: /* fallthrough */
+       case RPZ_INVALID_ACTION:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        default: return respip_invalid;
        }
 }
@@ -276,7 +284,9 @@ localzone_type_to_rpz_action(enum localzone_type lzt)
        case local_zone_always_transparent: return RPZ_PASSTHRU_ACTION;
        case local_zone_redirect: return RPZ_LOCAL_DATA_ACTION;
        case local_zone_truncate: return RPZ_TCP_ONLY_ACTION;
-       case local_zone_invalid: /* fallthrough */
+       case local_zone_invalid:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        default: return RPZ_INVALID_ACTION;
        }
 }
@@ -291,7 +301,9 @@ respip_action_to_rpz_action(enum respip_action a)
        case respip_always_transparent: return RPZ_PASSTHRU_ACTION;
        case respip_redirect: return RPZ_LOCAL_DATA_ACTION;
        case respip_truncate: return RPZ_TCP_ONLY_ACTION;
-       case respip_invalid: /* fallthrough */
+       case respip_invalid:
+               ATTR_FALLTHROUGH
+               /* fallthrough */
        default: return RPZ_INVALID_ACTION;
        }
 }
index dd1f334846637bdbbe6bff2df9145b110bfea9d2..f696c6af133177e840cc35361b3272e98cd6e04f 100644 (file)
@@ -436,11 +436,13 @@ sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz,
 
                /* ........ ........ ....4444 4....... ........ */
                         c =  src[3]         >> 7 ;
+               ATTR_FALLTHROUGH
                /* fallthrough */
        case 3: dst[4] = b32[(src[2] & 0x0f) << 1 | c];
 
                /* ........ .......3 3333.... ........ ........ */
                         c =  src[2]         >> 4 ;
+               ATTR_FALLTHROUGH
                /* fallthrough */
        case 2: dst[3] = b32[(src[1] & 0x01) << 4 | c];
 
@@ -449,6 +451,7 @@ sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz,
 
                /* .....111 11...... ........ ........ ........ */
                         c =  src[1]         >> 6 ;
+               ATTR_FALLTHROUGH
                /* fallthrough */
        case 1: dst[1] = b32[(src[0] & 0x07) << 2 | c];
 
@@ -460,11 +463,14 @@ sldns_b32_ntop_base(const uint8_t* src, size_t src_sz, char* dst, size_t dst_sz,
                switch (src_sz) {
                        case 1: dst[2] = '=';
                                dst[3] = '=';
+                               ATTR_FALLTHROUGH
                                /* fallthrough */
                        case 2: dst[4] = '=';
+                               ATTR_FALLTHROUGH
                                /* fallthrough */
                        case 3: dst[5] = '=';
                                dst[6] = '=';
+                               ATTR_FALLTHROUGH
                                /* fallthrough */
                        case 4: dst[7] = '=';
                }
@@ -577,17 +583,20 @@ sldns_b32_pton_base(const char* src, size_t src_sz, uint8_t* dst, size_t dst_sz,
                        /* ........ ........ ........ .55555.. ........ */
                        /* ........ ........ ....4444 4....... ........ */
                        dst[3] = buf[4] << 7 | buf[5] << 2 | buf[6] >> 3;
+                       ATTR_FALLTHROUGH
                        /* fallthrough */
 
                case 5: /* ........ ........ ....4444 4....... ........ */
                        /* ........ .......3 3333.... ........ ........ */
                        dst[2] = buf[3] << 4 | buf[4] >> 1;
+                       ATTR_FALLTHROUGH
                        /* fallthrough */
 
                case 4: /* ........ .......3 3333.... ........ ........ */
                        /* ........ ..22222. ........ ........ ........ */
                        /* .....111 11...... ........ ........ ........ */
                        dst[1] = buf[1] << 6 | buf[2] << 1 | buf[3] >> 4;
+                       ATTR_FALLTHROUGH
                        /* fallthrough */
 
                case 2: /* .....111 11...... ........ ........ ........ */
index 6962d7babc2fc67eded6b5f8394b33e63ff6f58d..ff8399947e8d5f908b254d247cfa6100cbb6123f 100644 (file)
@@ -1241,6 +1241,7 @@ int sldns_wire2str_svcparam_scan(uint8_t** d, size_t* dlen, char** s, size_t* sl
                r = sldns_wire2str_svcparam_ech2str(s, slen, data_len, *d);
                break;
        case SVCB_KEY_DOHPATH:
+               ATTR_FALLTHROUGH
                /* fallthrough */
        default:
                r = sldns_str_print(s, slen, "=\"");
index d06b7bb25e6eb76d9b60ae9f40f7b163a36275ab..ab1e0b557f09ddbc79f3248a664dd454dce052f5 100644 (file)
@@ -1091,6 +1091,7 @@ parse_edns_options_from_query(uint8_t* rdata_ptr, size_t rdata_len,
                                break;
                        case COOKIE_STATUS_CLIENT_ONLY:
                                edns->cookie_client = 1;
+                               ATTR_FALLTHROUGH
                                /* fallthrough */
                        case COOKIE_STATUS_FUTURE:
                        case COOKIE_STATUS_EXPIRED:
index dc5fd63fa6f6185469acfcbfe3a36955168c19e5..9d5131da96568bb6d56d61dc5e36adf3d8de8db6 100644 (file)
@@ -329,6 +329,7 @@ udp_send_errno_needs_log(struct sockaddr* addr, socklen_t addrlen)
                case EACCES:
                        if(verbosity < VERB_ALGO)
                                return 0;
+                       break;
                default:
                        break;
        }
index a188049740438e329704e9a791ca8f45f1fa68bb..235538b6251536467e331f1bb543984dd29addad 100644 (file)
@@ -153,6 +153,7 @@ pp2_write_to_buf(uint8_t* buf, size_t buflen,
                break;
 #endif /* INET6 */
        case AF_UNIX:
+               ATTR_FALLTHROUGH
                /* fallthrough */
        default:
                return 0;
index 32797dff60e55fdc52b7bfb2a4da0bf8875a7497..a13657ccffe18593e61dd74b12e6123dd03288f5 100644 (file)
@@ -128,26 +128,32 @@ int siphash(const uint8_t *in, const size_t inlen, const uint8_t *k,
     case 7:
         b |= ((uint64_t)in[6]) << 48;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 6:
         b |= ((uint64_t)in[5]) << 40;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 5:
         b |= ((uint64_t)in[4]) << 32;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 4:
         b |= ((uint64_t)in[3]) << 24;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 3:
         b |= ((uint64_t)in[2]) << 16;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 2:
         b |= ((uint64_t)in[1]) << 8;
         /** EDIT annotate case statement fallthrough for gcc */
+       ATTR_FALLTHROUGH
         /* fallthrough */
     case 1:
         b |= ((uint64_t)in[0]);
index f2a48f413da5ea4d9aa454fb697ca0b52735f66b..ae7c166ec37189554090de29a4435b481b43d388 100644 (file)
@@ -254,11 +254,15 @@ uint32_t        initval)         /* the previous hash, or an arbitrary value */
   switch(length)                     /* all the case statements fall through */
   { 
   case 3 : c+=k[2];
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 2 : b+=k[1];
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 1 : a+=k[0];
     final(a,b,c);
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 0:     /* case 0: nothing left to add */
     break;
   }
@@ -304,9 +308,15 @@ uint32_t       *pb)               /* IN: more seed OUT: secondary hash value */
   switch(length)                     /* all the case statements fall through */
   { 
   case 3 : c+=k[2];
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 2 : b+=k[1];
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 1 : a+=k[0];
     final(a,b,c);
+       ATTR_FALLTHROUGH
+       /* fallthrough */
   case 0:     /* case 0: nothing left to add */
     break;
   }
@@ -404,16 +414,32 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
-    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
-    case 9 : c+=k8[8];                   /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
+    case 10: c+=((uint32_t)k8[9])<<8;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
+    case 9 : c+=k8[8];
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
-    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
-    case 5 : b+=k8[4];                   /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
+    case 6 : b+=((uint32_t)k8[5])<<8;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
+    case 5 : b+=k8[4];
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 4 : a+=k[0]; break;
-    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
-    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
+    case 2 : a+=((uint32_t)k8[1])<<8;
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 1 : a+=k8[0]; break;
     case 0 : return c;
     }
@@ -443,23 +469,33 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 10: c+=k[4];
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 9 : c+=k8[8];                      /* fall through */
+    case 9 : c+=k8[8];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 6 : b+=k[2];
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 5 : b+=k8[4];                      /* fall through */
+    case 5 : b+=k8[4];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 2 : a+=k[0];
              break;
     case 1 : a+=k8[0];
@@ -494,27 +530,38 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
     switch(length)                   /* all the case statements fall through */
     {
     case 12: c+=((uint32_t)k[11])<<24;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 11: c+=((uint32_t)k[10])<<16;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 10: c+=((uint32_t)k[9])<<8;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 9 : c+=k[8];
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 8 : b+=((uint32_t)k[7])<<24;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 7 : b+=((uint32_t)k[6])<<16;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 6 : b+=((uint32_t)k[5])<<8;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 5 : b+=k[4];
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 4 : a+=((uint32_t)k[3])<<24;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 3 : a+=((uint32_t)k[2])<<16;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 2 : a+=((uint32_t)k[1])<<8;
-       /* fallthrough */
+       ATTR_FALLTHROUGH
+       /* fallthrough */
     case 1 : a+=k[0];
              break;
     case 0 : return c;
@@ -603,16 +650,32 @@ void hashlittle2(
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
-    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
-    case 9 : c+=k8[8];                   /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 10: c+=((uint32_t)k8[9])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 9 : c+=k8[8];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
-    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
-    case 5 : b+=k8[4];                   /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 6 : b+=((uint32_t)k8[5])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 5 : b+=k8[4];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=k[0]; break;
-    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
-    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 2 : a+=((uint32_t)k8[1])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 1 : a+=k8[0]; break;
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
     }
@@ -642,23 +705,33 @@ void hashlittle2(
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 11: c+=((uint32_t)k8[10])<<16;     /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 10: c+=k[4];
              b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 9 : c+=k8[8];                      /* fall through */
+    case 9 : c+=k8[8];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 7 : b+=((uint32_t)k8[6])<<16;      /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 6 : b+=k[2];
              a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 5 : b+=k8[4];                      /* fall through */
+    case 5 : b+=k8[4];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
              break;
-    case 3 : a+=((uint32_t)k8[2])<<16;      /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 2 : a+=k[0];
              break;
     case 1 : a+=k8[0];
@@ -693,16 +766,38 @@ void hashlittle2(
     switch(length)                   /* all the case statements fall through */
     {
     case 12: c+=((uint32_t)k[11])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 11: c+=((uint32_t)k[10])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 10: c+=((uint32_t)k[9])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 9 : c+=k[8];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=((uint32_t)k[7])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 7 : b+=((uint32_t)k[6])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 6 : b+=((uint32_t)k[5])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 5 : b+=k[4];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=((uint32_t)k[3])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 3 : a+=((uint32_t)k[2])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 2 : a+=((uint32_t)k[1])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 1 : a+=k[0];
              break;
     case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
@@ -784,16 +879,32 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
     switch(length)                   /* all the case statements fall through */
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
-    case 11: c+=((uint32_t)k8[10])<<8;  /* fall through */
-    case 10: c+=((uint32_t)k8[9])<<16;  /* fall through */
-    case 9 : c+=((uint32_t)k8[8])<<24;  /* fall through */
+    case 11: c+=((uint32_t)k8[10])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 10: c+=((uint32_t)k8[9])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 9 : c+=((uint32_t)k8[8])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=k[1]; a+=k[0]; break;
-    case 7 : b+=((uint32_t)k8[6])<<8;   /* fall through */
-    case 6 : b+=((uint32_t)k8[5])<<16;  /* fall through */
-    case 5 : b+=((uint32_t)k8[4])<<24;  /* fall through */
+    case 7 : b+=((uint32_t)k8[6])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 6 : b+=((uint32_t)k8[5])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 5 : b+=((uint32_t)k8[4])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=k[0]; break;
-    case 3 : a+=((uint32_t)k8[2])<<8;   /* fall through */
-    case 2 : a+=((uint32_t)k8[1])<<16;  /* fall through */
+    case 3 : a+=((uint32_t)k8[2])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
+    case 2 : a+=((uint32_t)k8[1])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 1 : a+=((uint32_t)k8[0])<<24; break;
     case 0 : return c;
     }
@@ -827,16 +938,38 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
     switch(length)                   /* all the case statements fall through */
     {
     case 12: c+=k[11];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 11: c+=((uint32_t)k[10])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 10: c+=((uint32_t)k[9])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 9 : c+=((uint32_t)k[8])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 8 : b+=k[7];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 7 : b+=((uint32_t)k[6])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 6 : b+=((uint32_t)k[5])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 5 : b+=((uint32_t)k[4])<<24;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 4 : a+=k[3];
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 3 : a+=((uint32_t)k[2])<<8;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 2 : a+=((uint32_t)k[1])<<16;
+            ATTR_FALLTHROUGH
+            /* fallthrough */
     case 1 : a+=((uint32_t)k[0])<<24;
              break;
     case 0 : return c;
index 40ebb1728d493d70d54b02f1955a8671d01c4909..be8347b1bc88ea6702ff568a2c767a9e43a697c0 100644 (file)
@@ -2060,11 +2060,13 @@ verify_canonrrset(sldns_buffer* buf, int algo, unsigned char* sigblock,
                digest_size = (digest_size ? digest_size : SHA1_DIGEST_SIZE);
 #endif
                /* double fallthrough annotation to please gcc parser */
+               ATTR_FALLTHROUGH
                /* fallthrough */
 #ifdef USE_SHA2
                /* fallthrough */
        case LDNS_RSASHA256:
                digest_size = (digest_size ? digest_size : SHA256_DIGEST_SIZE);
+               ATTR_FALLTHROUGH
                /* fallthrough */
        case LDNS_RSASHA512:
                digest_size = (digest_size ? digest_size : SHA512_DIGEST_SIZE);
@@ -2080,6 +2082,7 @@ verify_canonrrset(sldns_buffer* buf, int algo, unsigned char* sigblock,
 #ifdef USE_ECDSA
        case LDNS_ECDSAP256SHA256:
                digest_size = (digest_size ? digest_size : SHA256_DIGEST_SIZE);
+               ATTR_FALLTHROUGH
                /* fallthrough */
        case LDNS_ECDSAP384SHA384:
                digest_size = (digest_size ? digest_size : SHA384_DIGEST_SIZE);