diff --git a/meson.build b/meson.build index b038d6df820..6f3f3193856 100644 --- a/meson.build +++ b/meson.build @@ -271,7 +271,7 @@ foreach arg : ['-Wextra', '-Wstrict-prototypes', '-Wredundant-decls', '-Wmissing-noreturn', - '-Wimplicit-fallthrough=3', + '-Wimplicit-fallthrough=5', '-Wshadow', '-Wendif-labels', '-Wstrict-aliasing=2', diff --git a/src/basic/MurmurHash2.c b/src/basic/MurmurHash2.c index a282a212014..47adfb4d0a3 100644 --- a/src/basic/MurmurHash2.c +++ b/src/basic/MurmurHash2.c @@ -15,6 +15,10 @@ #include "MurmurHash2.h" +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif + //----------------------------------------------------------------------------- // Platform-specific functions and macros diff --git a/src/basic/generate-gperfs.py b/src/basic/generate-gperfs.py index d4cc9aa45c2..aca9ab1fe91 100755 --- a/src/basic/generate-gperfs.py +++ b/src/basic/generate-gperfs.py @@ -7,6 +7,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 diff --git a/src/basic/macro.h b/src/basic/macro.h index 13652fb94db..2c6e46b6c83 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -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 \ diff --git a/src/basic/siphash24.c b/src/basic/siphash24.c index 4bb41786c8b..d3a81b7cc16 100644 --- a/src/basic/siphash24.c +++ b/src/basic/siphash24.c @@ -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; } diff --git a/src/basic/time-util.c b/src/basic/time-util.c index f5af3281a10..bd5a6ae613b 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -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; diff --git a/src/core/job.c b/src/core/job.c index b01c9c13730..46defae1bc8 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -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; diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 716145a8ff4..eff2b0e7410 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "load-fragment.h" diff --git a/src/core/main.c b/src/core/main.c index ee9594a00fc..1fc24eac76a 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -2155,7 +2155,7 @@ int main(int argc, char *argv[]) { goto finish; } - /* fallthrough */ + _fallthrough_; case MANAGER_REBOOT: case MANAGER_POWEROFF: case MANAGER_HALT: diff --git a/src/core/manager.c b/src/core/manager.c index 67fe3d21202..cd723e7f479 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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); diff --git a/src/core/namespace.c b/src/core/namespace.c index 738a1f51343..218f2d8d9ac 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -796,8 +796,8 @@ static int apply_mount( case BIND_MOUNT: rbind = false; - /* fallthrough */ + _fallthrough_; case BIND_MOUNT_RECURSIVE: /* Also chase the source mount */ diff --git a/src/core/service.c b/src/core/service.c index 1dfde82816d..ccb8bdba320 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2892,8 +2892,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 && @@ -3054,8 +3053,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; diff --git a/src/core/shutdown.c b/src/core/shutdown.c index 04494f4eee4..d54661b6987 100644 --- a/src/core/shutdown.c +++ b/src/core/shutdown.c @@ -396,8 +396,7 @@ int main(int argc, char *argv[]) { } cmd = RB_AUTOBOOT; - /* Fall through */ - + _fallthrough_; case RB_AUTOBOOT: if (!in_container) { diff --git a/src/core/socket.c b/src/core/socket.c index 6c0d799bd97..a1cc560d5b9 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -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; } diff --git a/src/core/timer.c b/src/core/timer.c index 27f4f74b49e..1a42b3847e4 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -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; diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c index a9751c25c53..6c214d27fc4 100644 --- a/src/journal-remote/journal-upload-journal.c +++ b/src/journal-remote/journal-upload-journal.c @@ -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; diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 4da0f3cdab4..faa7e9bab67 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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; diff --git a/src/journal/journald-gperf.gperf b/src/journal/journald-gperf.gperf index 6b05bda0aec..e8c1f2e2d51 100644 --- a/src/journal/journald-gperf.gperf +++ b/src/journal/journald-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include #include "conf-parser.h" diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 93ca61fc8a4..fae2cd59bec 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -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; diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 536bfef99e0..228af69d888 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -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 diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 4fec89d2e39..1c12e5430f4 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -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; diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c index 1b2530ea33d..7cf4f031de5 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/sd-ipv4acd.c @@ -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); diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 8a33d462b46..23739292852 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -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) diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index 1957654d284..9fb455a94e2 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -1756,8 +1756,7 @@ static int add_object_vtable_internal( goto fail; } - /* Fall through */ - + _fallthrough_; case _SD_BUS_VTABLE_PROPERTY: { struct vtable_member *m; diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 273cbaeb423..b278eefa205 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -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'; diff --git a/src/libsystemd/sd-id128/id128-util.c b/src/libsystemd/sd-id128/id128-util.c index 260a11dfc1d..5541e8d47e6 100644 --- a/src/libsystemd/sd-id128/id128-util.c +++ b/src/libsystemd/sd-id128/id128-util.c @@ -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; diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf index aca464427b7..ee62db63a55 100644 --- a/src/login/logind-gperf.gperf +++ b/src/login/logind-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "logind.h" diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index 002efd7e9cf..89f600ef623 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "network-internal.h" diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 302c75d1706..976be17c0e4 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -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: diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 81086d26fd1..a46a11bf167 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -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) { diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf index eca436d9fde..54161446bba 100644 --- a/src/network/networkd-gperf.gperf +++ b/src/network/networkd-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "networkd-conf.h" diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 2040f82b9fe..62c47d6eae0 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "networkd-conf.h" diff --git a/src/nspawn/nspawn-gperf.gperf b/src/nspawn/nspawn-gperf.gperf index b61b347ee7c..ea66971fac7 100644 --- a/src/nspawn/nspawn-gperf.gperf +++ b/src/nspawn/nspawn-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "nspawn-settings.h" diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 85ba86b62ce..3bf4d6ed1bd 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -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; diff --git a/src/resolve/generate-dns_type-gperf.py b/src/resolve/generate-dns_type-gperf.py index 8a0b43c277a..d4f7b947387 100755 --- a/src/resolve/generate-dns_type-gperf.py +++ b/src/resolve/generate-dns_type-gperf.py @@ -7,6 +7,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 diff --git a/src/resolve/resolved-gperf.gperf b/src/resolve/resolved-gperf.gperf index 5153563b999..a5865ce6c29 100644 --- a/src/resolve/resolved-gperf.gperf +++ b/src/resolve/resolved-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "resolved-conf.h" diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c index 2dff66d00aa..7676a93e8b7 100644 --- a/src/shared/machine-image.c +++ b/src/shared/machine-image.c @@ -523,8 +523,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; @@ -609,8 +608,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; diff --git a/src/timesync/timesyncd-gperf.gperf b/src/timesync/timesyncd-gperf.gperf index e8ef5851e12..7d4cd2808ea 100644 --- a/src/timesync/timesyncd-gperf.gperf +++ b/src/timesync/timesyncd-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "timesyncd-conf.h" diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 173774ea0a0..a43d1552984 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -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) diff --git a/src/udev/generate-keyboard-keys-gperf.sh b/src/udev/generate-keyboard-keys-gperf.sh index 5724e4e3dc5..eb977447e3c 100755 --- a/src/udev/generate-keyboard-keys-gperf.sh +++ b/src/udev/generate-keyboard-keys-gperf.sh @@ -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 "%%" diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf index 52bb4775dd1..85f0a0625b2 100644 --- a/src/udev/net/link-config-gperf.gperf +++ b/src/udev/net/link-config-gperf.gperf @@ -1,4 +1,7 @@ %{ +#if __GNUC__ >= 7 +_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +#endif #include #include "conf-parser.h" #include "network-internal.h" diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 876525c3fff..89891f9e274 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -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 */ diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c index 11c2b953e48..bf6b28e8e53 100644 --- a/src/udev/scsi_id/scsi_serial.c +++ b/src/udev/scsi_id/scsi_serial.c @@ -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; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 15a309fe794..e9588abd695 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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)