]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 31 Jan 2017 19:04:55 +0000 (14:04 -0500)
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
src/core/socket.c
src/core/timer.c
src/journal/journal-file.c
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd/sd-device/sd-device.c
src/nspawn/nspawn.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 7a5b29d77e5cfa5dfeb501fc0dc2c7b65cd91ced..1310c76336e10edbe27161c92bac37ec58ea0463 100644 (file)
@@ -1271,7 +1271,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 */
index 3cae6b31bbcfd05b878a7612518933987ce24258..a7b9ada65cae851ffd697577d2e7572486eef4d3 100644 (file)
@@ -2668,6 +2668,7 @@ const char* socket_port_type_to_string(SocketPort *p) {
                         if (socket_address_family(&p->address) == AF_NETLINK)
                                 return "Netlink";
 
+                        /* fall through */
                 default:
                         return NULL;
                 }
index c6b28dd9c5982fa5c8c76cf200a22d94729ffa7e..5ee14669d2a2cb4b9643dafc8a93f34a7c15771f 100644 (file)
@@ -422,7 +422,8 @@ static void timer_enter_waiting(Timer *t, bool initial) {
                                 }
                                 /* In a container we don't want to include the time the host
                                  * was already up when the container started, so count from
-                                 * our own startup. Fall through. */
+                                 * our own startup. */
+                                /* fall through */
                         case TIMER_STARTUP:
                                 base = UNIT(t)->manager->userspace_timestamp.monotonic;
                                 break;
index d3e021473185b09750d547efbd7a3c55b5a825e5..e45d1905e7e5ad32df6f6f4b60abd9b2442bc7df 100644 (file)
@@ -285,7 +285,7 @@ static int journal_file_set_online(JournalFile *f) {
                                 continue;
                         /* Canceled restart from offlining, must wait for offlining to complete however. */
 
-                        /* fall through to wait */
+                        /* fall through */
                 default: {
                         int r;
 
index e81215f7d77ff737743b586ab2799dc918ff1e1d..6444b0ce94b0999c64f646ade647af23781129d5 100644 (file)
@@ -999,7 +999,7 @@ static int client_receive_message(
                         break;
                 }
 
-                /* fall through for Soliciation Rapid Commit option check */
+                /* fall through */ /* for Soliciation Rapid Commit option check */
         case DHCP6_STATE_REQUEST:
         case DHCP6_STATE_RENEW:
         case DHCP6_STATE_REBIND:
index bc5e92f8fe62c28e3abc9785f05a061b4dbb6f43..efeadf0cd4ba1219e5ee02401c620b2fba68835c 100644 (file)
@@ -560,7 +560,7 @@ int device_read_uevent_file(sd_device *device) {
                         value = &uevent[i];
                         state = VALUE;
 
-                        /* fall through to handle empty property */
+                        /* fall through */ /* to handle empty property */
                 case VALUE:
                         if (strchr(NEWLINE, uevent[i])) {
                                 uevent[i] = '\0';
index 18d42908ff2d6341f650b4c23b0fdc79d0596138..4913907b69d3c31941e66ed3a2a48d043ed46d23 100644 (file)
@@ -1917,7 +1917,7 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
                         return 0;
                 }
 
-                /* CLD_KILLED fallthrough */
+                /* fall through */
 
         case CLD_DUMPED:
                 log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));