chiark / gitweb /
tree-wide: adjust fall through comments so that gcc is happy
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Jan 2017 05:50:10 +0000 (00:50 -0500)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:36 +0000 (17:58 +0200)
gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much
value.

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)

src/basic/siphash24.c
src/basic/time-util.c

index 8c1cdc3db6afd6bc8a1a13cfa0e05e5f24a5bc6e..4bb41786c8b2a27b224ca9b9a0a682bde50e6fb8 100644 (file)
@@ -127,18 +127,25 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
         switch (left) {
                 case 7:
                         state->padding |= ((uint64_t) in[6]) << 48;
+                        /* fall through */
                 case 6:
                         state->padding |= ((uint64_t) in[5]) << 40;
+                        /* fall through */
                 case 5:
                         state->padding |= ((uint64_t) in[4]) << 32;
+                        /* fall through */
                 case 4:
                         state->padding |= ((uint64_t) in[3]) << 24;
+                        /* fall through */
                 case 3:
                         state->padding |= ((uint64_t) in[2]) << 16;
+                        /* fall through */
                 case 2:
                         state->padding |= ((uint64_t) in[1]) <<  8;
+                        /* fall through */
                 case 1:
                         state->padding |= ((uint64_t) in[0]);
+                        /* fall through */
                 case 0:
                         break;
         }
index 467503c1b55f66dfa6a761ccb3c9849ce90057c7..ecb621ec44f4de7b1f4018abea83e806ccaf7470 100644 (file)
@@ -1289,7 +1289,7 @@ bool clock_supported(clockid_t clock) {
                 if (!clock_boottime_supported())
                         return false;
 
-                /* fall through, after checking the cached value for CLOCK_BOOTTIME. */
+                /* fall through */
 
         default:
                 /* For everything else, check properly */