tree-wide: adjust fall through comments so that gcc is happy
authorShawn Landden <slandden@gmail.com>
Sun, 19 Nov 2017 18:06:10 +0000 (10:06 -0800)
committerShawn Landden <slandden@gmail.com>
Mon, 20 Nov 2017 21:06:25 +0000 (13:06 -0800)
Distcc removes comments, making the comment silencing
not work.

I know there was a decision against a macro in commit
ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2

43 files changed:
src/basic/MurmurHash2.c
src/basic/generate-gperfs.py
src/basic/macro.h
src/basic/siphash24.c
src/basic/time-util.c
src/core/job.c
src/core/load-fragment-gperf.gperf.m4
src/core/main.c
src/core/manager.c
src/core/namespace.c
src/core/service.c
src/core/shutdown.c
src/core/socket.c
src/core/timer.c
src/journal-remote/journal-upload-journal.c
src/journal/journal-file.c
src/journal/journald-gperf.gperf
src/journal/journald-syslog.c
src/libsystemd-network/sd-dhcp-client.c
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd-network/sd-ipv4acd.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-id128/id128-util.c
src/login/logind-gperf.gperf
src/network/netdev/netdev-gperf.gperf
src/network/networkd-address.c
src/network/networkd-dhcp6.c
src/network/networkd-gperf.gperf
src/network/networkd-network-gperf.gperf
src/nspawn/nspawn-gperf.gperf
src/nspawn/nspawn.c
src/resolve/generate-dns_type-gperf.py
src/resolve/resolved-gperf.gperf
src/shared/machine-image.c
src/timesync/timesyncd-gperf.gperf
src/tmpfiles/tmpfiles.c
src/udev/generate-keyboard-keys-gperf.sh
src/udev/net/link-config-gperf.gperf
src/udev/net/link-config.c
src/udev/scsi_id/scsi_serial.c
src/udev/udev-rules.c

index a282a21..47adfb4 100644 (file)
 
 #include "MurmurHash2.h"
 
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
+
 //-----------------------------------------------------------------------------
 // Platform-specific functions and macros
 
index d4cc9aa..aca9ab1 100755 (executable)
@@ -8,6 +8,12 @@ import sys
 name, prefix, input = sys.argv[1:]
 
 print("""\
+%{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
+#endif
+%}""")
+print("""\
 struct {}_name {{ const char* name; int id; }};
 %null-strings
 %%""".format(name))
index 13652fb..2c6e46b 100644 (file)
@@ -48,6 +48,7 @@
 #define _weakref_(x) __attribute__((weakref(#x)))
 #define _alignas_(x) __attribute__((aligned(__alignof(x))))
 #define _cleanup_(x) __attribute__((cleanup(x)))
+#define _fallthrough_ __attribute__((fallthrough))
 
 /* Temporarily disable some warnings */
 #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT                     \
index 4bb4178..d3a81b7 100644 (file)
@@ -127,25 +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 */
+                        _fallthrough_;
                 case 6:
                         state->padding |= ((uint64_t) in[5]) << 40;
-                        /* fall through */
+                        _fallthrough_;
                 case 5:
                         state->padding |= ((uint64_t) in[4]) << 32;
-                        /* fall through */
+                        _fallthrough_;
                 case 4:
                         state->padding |= ((uint64_t) in[3]) << 24;
-                        /* fall through */
+                        _fallthrough_;
                 case 3:
                         state->padding |= ((uint64_t) in[2]) << 16;
-                        /* fall through */
+                        _fallthrough_;
                 case 2:
                         state->padding |= ((uint64_t) in[1]) <<  8;
-                        /* fall through */
+                        _fallthrough_;
                 case 1:
                         state->padding |= ((uint64_t) in[0]);
-                        /* fall through */
+                        _fallthrough_;
                 case 0:
                         break;
         }
index f5af328..bd5a6ae 100644 (file)
@@ -1382,8 +1382,7 @@ bool clock_supported(clockid_t clock) {
                 if (!clock_boottime_supported())
                         return false;
 
-                /* fall through */
-
+                _fallthrough_;
         default:
                 /* For everything else, check properly */
                 return clock_gettime(clock, &ts) >= 0;
index b01c9c1..46defae 100644 (file)
@@ -532,7 +532,7 @@ static int job_perform_on_unit(Job **j) {
 
                 case JOB_RESTART:
                         t = JOB_STOP;
-                        /* fall through */
+                        _fallthrough_;
                 case JOB_STOP:
                         r = unit_stop(u);
                         break;
index 73b1397..420ca13 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "load-fragment.h"
index ee9594a..1fc24ea 100644 (file)
@@ -2155,7 +2155,7 @@ int main(int argc, char *argv[]) {
                                 goto finish;
                         }
 
-                        /* fallthrough */
+                        _fallthrough_;
                 case MANAGER_REBOOT:
                 case MANAGER_POWEROFF:
                 case MANAGER_HALT:
index 67fe3d2..cd723e7 100644 (file)
@@ -2113,8 +2113,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
                                 break;
                         }
 
-                        /* Fall through */
-
+                        _fallthrough_;
                 case SIGINT:
                         if (MANAGER_IS_SYSTEM(m))
                                 manager_handle_ctrl_alt_del(m);
index 738a1f5..218f2d8 100644 (file)
@@ -796,8 +796,8 @@ static int apply_mount(
 
         case BIND_MOUNT:
                 rbind = false;
-                /* fallthrough */
 
+                _fallthrough_;
         case BIND_MOUNT_RECURSIVE:
                 /* Also chase the source mount */
 
index 445d1be..b4662cd 100644 (file)
@@ -2895,8 +2895,7 @@ static void service_notify_cgroup_empty_event(Unit *u) {
                         break;
                 }
 
-                /* Fall through */
-
+                _fallthrough_;
         case SERVICE_START_POST:
                 if (s->pid_file_pathspec &&
                     main_pid_good(s) == 0 &&
@@ -3057,8 +3056,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                                         break;
                                 }
 
-                                /* Fall through */
-
+                                _fallthrough_;
                         case SERVICE_RUNNING:
                                 service_enter_running(s, f);
                                 break;
index 04494f4..d54661b 100644 (file)
@@ -396,8 +396,7 @@ int main(int argc, char *argv[]) {
                 }
 
                 cmd = RB_AUTOBOOT;
-                /* Fall through */
-
+                _fallthrough_;
         case RB_AUTOBOOT:
 
                 if (!in_container) {
index 6c0d799..a1cc560 100644 (file)
@@ -2766,7 +2766,7 @@ const char* socket_port_type_to_string(SocketPort *p) {
                         if (socket_address_family(&p->address) == AF_NETLINK)
                                 return "Netlink";
 
-                        /* fall through */
+                        _fallthrough_;
                 default:
                         return NULL;
                 }
index 27f4f74..1a42b38 100644 (file)
@@ -417,7 +417,7 @@ 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 */
+                                _fallthrough_;
                         case TIMER_STARTUP:
                                 base = UNIT(t)->manager->userspace_timestamp.monotonic;
                                 break;
index a9751c2..6c214d2 100644 (file)
@@ -63,8 +63,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         }
 
                         pos += r;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_REALTIME: {
                         usec_t realtime;
 
@@ -87,8 +87,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         }
 
                         pos += r;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_MONOTONIC: {
                         usec_t monotonic;
                         sd_id128_t boot_id;
@@ -112,8 +112,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         }
 
                         pos += r;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_BOOT_ID: {
                         sd_id128_t boot_id;
                         char sid[33];
@@ -137,8 +137,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         }
 
                         pos += r;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_NEW_FIELD: {
                         u->field_pos = 0;
 
@@ -159,8 +159,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
                         }
 
                         u->entry_state++;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_TEXT_FIELD:
                 case ENTRY_BINARY_FIELD: {
                         bool done;
@@ -209,8 +209,8 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
 
                         u->field_pos = len + 1;
                         u->entry_state++;
-                }       /* fall through */
-
+                }
+                        _fallthrough_;
                 case ENTRY_BINARY_FIELD_SIZE: {
                         uint64_t le64;
 
index 4da0f3c..faa7e9b 100644 (file)
@@ -133,8 +133,7 @@ static void journal_file_set_offline_internal(JournalFile *f) {
                 case OFFLINE_OFFLINING:
                         if (!__sync_bool_compare_and_swap(&f->offline_state, OFFLINE_OFFLINING, OFFLINE_DONE))
                                 continue;
-                        /* fall through */
-
+                        _fallthrough_;
                 case OFFLINE_DONE:
                         return;
 
@@ -290,8 +289,7 @@ static int journal_file_set_online(JournalFile *f) {
                         if (!__sync_bool_compare_and_swap(&f->offline_state, OFFLINE_AGAIN_FROM_OFFLINING, OFFLINE_CANCEL))
                                 continue;
                         /* Canceled restart from offlining, must wait for offlining to complete however. */
-
-                        /* fall through */
+                        _fallthrough_;
                 default: {
                         int r;
 
index 6b05bda..e8c1f2e 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include <sys/socket.h>
 #include "conf-parser.h"
index 93ca61f..fae2cd5 100644 (file)
@@ -287,8 +287,7 @@ static void syslog_skip_date(char **buf) {
                         if (*p == ' ')
                                 break;
 
-                        /* fall through */
-
+                        _fallthrough_;
                 case NUMBER:
                         if (*p < '0' || *p > '9')
                                 return;
index 536bfef..228af69 100644 (file)
@@ -829,7 +829,6 @@ static int client_send_request(sd_dhcp_client *client) {
                    client’s IP address.
                 */
 
-                /* fall through */
         case DHCP_STATE_REBINDING:
                 /* â€™server identifier’ MUST NOT be filled in, â€™requested IP address’
                    option MUST NOT be filled in, â€™ciaddr’ MUST be filled in with
index 4fec89d..1c12e54 100644 (file)
@@ -1035,7 +1035,7 @@ static int client_receive_message(
                         break;
                 }
 
-                /* fall through */ /* for Soliciation Rapid Commit option check */
+                _fallthrough_; /* for Soliciation Rapid Commit option check */
         case DHCP6_STATE_REQUEST:
         case DHCP6_STATE_RENEW:
         case DHCP6_STATE_REBIND:
@@ -1100,7 +1100,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state) {
                         return 0;
                 }
 
-                /* fall through */
+                _fallthrough_;
         case DHCP6_STATE_SOLICITATION:
                 client->state = DHCP6_STATE_SOLICITATION;
 
index 1b2530e..7cf4f03 100644 (file)
@@ -288,8 +288,7 @@ static int ipv4acd_on_timeout(sd_event_source *s, uint64_t usec, void *userdata)
                         break;
                 }
 
-                /* fall through */
-
+                _fallthrough_;
         case IPV4ACD_STATE_WAITING_ANNOUNCE:
                 /* Send announcement packet */
                 r = arp_send_announcement(acd->fd, acd->ifindex, acd->address, &acd->mac_addr);
index 8a33d46..2373929 100644 (file)
@@ -1452,7 +1452,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
                 case SD_BUS_TYPE_STRING:
                         p = strempty(p);
 
-                        /* Fall through... */
+                        _fallthrough_;
                 case SD_BUS_TYPE_OBJECT_PATH:
                         if (!p)
                                 return -EINVAL;
@@ -1512,7 +1512,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
                          * into the empty string */
                         p = strempty(p);
 
-                        /* Fall through... */
+                        _fallthrough_;
                 case SD_BUS_TYPE_OBJECT_PATH:
 
                         if (!p)
index 1957654..9fb455a 100644 (file)
@@ -1756,8 +1756,7 @@ static int add_object_vtable_internal(
                                 goto fail;
                         }
 
-                        /* Fall through */
-
+                        _fallthrough_;
                 case _SD_BUS_VTABLE_PROPERTY: {
                         struct vtable_member *m;
 
index 273cbae..b278eef 100644 (file)
@@ -564,7 +564,7 @@ int device_read_uevent_file(sd_device *device) {
                         value = &uevent[i];
                         state = VALUE;
 
-                        /* fall through */ /* to handle empty property */
+                        _fallthrough_; /* to handle empty property */
                 case VALUE:
                         if (strchr(NEWLINE, uevent[i])) {
                                 uevent[i] = '\0';
index 260a11d..5541e8d 100644 (file)
@@ -117,7 +117,7 @@ int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret) {
                 if (buffer[32] != '\n')
                         return -EINVAL;
 
-                /* fall through */
+                _fallthrough_;
         case 32: /* plain UUID without trailing newline */
                 if (f == ID128_UUID)
                         return -EINVAL;
@@ -129,7 +129,7 @@ int id128_read_fd(int fd, Id128Format f, sd_id128_t *ret) {
                 if (buffer[36] != '\n')
                         return -EINVAL;
 
-                /* fall through */
+                _fallthrough_;
         case 36: /* RFC UUID without trailing newline */
                 if (f == ID128_PLAIN)
                         return -EINVAL;
index aca4644..ee62db6 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "logind.h"
index 002efd7..89f600e 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "network-internal.h"
index 302c75d..976be17 100644 (file)
@@ -152,7 +152,7 @@ static void address_hash_func(const void *b, struct siphash *state) {
                         siphash24_compress(&prefix, sizeof(prefix), state);
                 }
 
-                /* fallthrough */
+                _fallthrough_;
         case AF_INET6:
                 /* local address */
                 siphash24_compress(&a->in_addr, FAMILY_ADDRESS_SIZE(a->family), state);
@@ -202,7 +202,7 @@ static int address_compare_func(const void *c1, const void *c2) {
                                 return 1;
                 }
 
-                /* fall-through */
+                _fallthrough_;
         case AF_INET6:
                 return memcmp(&a1->in_addr, &a2->in_addr, FAMILY_ADDRESS_SIZE(a1->family));
         default:
index 81086d2..a46a11b 100644 (file)
@@ -149,7 +149,7 @@ static void dhcp6_handler(sd_dhcp6_client *client, int event, void *userdata) {
                         return;
                 }
 
-                /* fall through */
+                _fallthrough_;
         case SD_DHCP6_CLIENT_EVENT_INFORMATION_REQUEST:
                 r = dhcp6_lease_information_acquired(client, link);
                 if (r < 0) {
index eca436d..5416144 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "networkd-conf.h"
index ca0d67e..5643e10 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "networkd-conf.h"
index b61b347..ea66971 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "nspawn-settings.h"
index 85ba86b..3bf4d6e 100644 (file)
@@ -569,8 +569,7 @@ static int parse_argv(int argc, char *argv[]) {
                         if (r < 0)
                                 return log_oom();
 
-                        /* fall through */
-
+                        _fallthrough_;
                 case 'n':
                         arg_network_veth = true;
                         arg_private_network = true;
@@ -624,8 +623,7 @@ static int parse_argv(int argc, char *argv[]) {
                         if (strv_extend(&arg_network_ipvlan, optarg) < 0)
                                 return log_oom();
 
-                        /* fall through */
-
+                        _fallthrough_;
                 case ARG_PRIVATE_NETWORK:
                         arg_private_network = true;
                         arg_settings_mask |= SETTING_NETWORK;
@@ -2013,8 +2011,7 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
                         return 0;
                 }
 
-                /* fall through */
-
+                _fallthrough_;
         case CLD_DUMPED:
                 log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
                 return -EIO;
index 8a0b43c..d4f7b94 100755 (executable)
@@ -8,6 +8,12 @@ import sys
 name, prefix, input = sys.argv[1:]
 
 print("""\
+%{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
+#endif
+%}""")
+print("""\
 struct {}_name {{ const char* name; int id; }};
 %null-strings
 %%""".format(name))
index 5153563..a5865ce 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "resolved-conf.h"
index a9e5d60..2625a20 100644 (file)
@@ -513,8 +513,7 @@ int image_remove(Image *i) {
                 if (path_startswith(i->path, "/dev"))
                         break;
 
-                /* fallthrough */
-
+                _fallthrough_;
         case IMAGE_RAW:
                 if (unlink(i->path) < 0)
                         return -errno;
@@ -599,8 +598,7 @@ int image_rename(Image *i, const char *new_name) {
                 if (file_attr & FS_IMMUTABLE_FL)
                         (void) chattr_path(i->path, 0, FS_IMMUTABLE_FL);
 
-                /* fall through */
-
+                _fallthrough_;
         case IMAGE_SUBVOLUME:
                 new_path = file_in_same_dir(i->path, new_name);
                 break;
index e8ef585..7d4cd28 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "timesyncd-conf.h"
index 173774e..a43d155 100644 (file)
@@ -1305,8 +1305,7 @@ static int create_item(Item *i) {
                                 log_debug("Quota for subvolume \"%s\" already in place, no change made.", i->path);
                 }
 
-                /* fall through */
-
+                _fallthrough_;
         case EMPTY_DIRECTORY:
                 r = path_set_perms(i, i->path);
                 if (q < 0)
index 5724e4e..eb97744 100755 (executable)
@@ -1,5 +1,10 @@
 #!/bin/sh -eu
 awk '   BEGIN {
+                print "%{\n\
+#if __GNUC__ >= 7\n\
+_Pragma(\"GCC diagnostic ignored \\\"-Wimplicit-fallthrough\\\"\")\n\
+#endif\n\
+%}"
                 print "struct key_name { const char* name; unsigned short id; };"
                 print "%null-strings"
                 print "%%"
index 52bb477..85f0a06 100644 (file)
@@ -1,4 +1,7 @@
 %{
+#if __GNUC__ >= 7
+_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+#endif
 #include <stddef.h>
 #include "conf-parser.h"
 #include "network-internal.h"
index 876525c..89891f9 100644 (file)
@@ -328,7 +328,7 @@ static bool should_rename(struct udev_device *device, bool respect_predictable)
                 /* the kernel claims to have given a predictable name */
                 if (respect_predictable)
                         return false;
-                /* fall through */
+                _fallthrough_;
         case NET_NAME_ENUM:
         default:
                 /* the name is known to be bad, or of an unknown type */
index 11c2b95..bf6b28e 100644 (file)
@@ -372,7 +372,7 @@ resend:
         switch (retval) {
                 case SG_ERR_CAT_NOTSUPPORTED:
                         buf[1] = 0;
-                        /* Fallthrough */
+                        _fallthrough_;
                 case SG_ERR_CAT_CLEAN:
                 case SG_ERR_CAT_RECOVERED:
                         retval = 0;
index 15a309f..e9588ab 100644 (file)
@@ -1691,7 +1691,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct
         case SB_FORMAT:
                 udev_event_apply_format(event, name, nbuf, sizeof(nbuf), false);
                 name = nbuf;
-                /* fall through */
+                _fallthrough_;
         case SB_NONE:
                 value = udev_device_get_sysattr_value(dev, name);
                 if (value == NULL)