mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
tree-wide: adjust fall through comments so that gcc is happy
Distcc removes comments, making the comment silencing
not work.
I know there was a decision against a macro in commit
ec251fe7d5
This commit is contained in:
parent
d8bd96ab54
commit
4831981d89
@ -15,6 +15,10 @@
|
||||
|
||||
#include "MurmurHash2.h"
|
||||
|
||||
#if __GNUC__ >= 7
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Platform-specific functions and macros
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -2155,7 +2155,7 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
/* fallthrough */
|
||||
_fallthrough_;
|
||||
case MANAGER_REBOOT:
|
||||
case MANAGER_POWEROFF:
|
||||
case MANAGER_HALT:
|
||||
|
@ -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);
|
||||
|
@ -796,8 +796,8 @@ static int apply_mount(
|
||||
|
||||
case BIND_MOUNT:
|
||||
rbind = false;
|
||||
/* fallthrough */
|
||||
|
||||
_fallthrough_;
|
||||
case BIND_MOUNT_RECURSIVE:
|
||||
/* Also chase the source mount */
|
||||
|
||||
|
@ -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;
|
||||
|
@ -396,8 +396,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
cmd = RB_AUTOBOOT;
|
||||
/* Fall through */
|
||||
|
||||
_fallthrough_;
|
||||
case RB_AUTOBOOT:
|
||||
|
||||
if (!in_container) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -1756,8 +1756,7 @@ static int add_object_vtable_internal(
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Fall through */
|
||||
|
||||
_fallthrough_;
|
||||
case _SD_BUS_VTABLE_PROPERTY: {
|
||||
struct vtable_member *m;
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,7 @@
|
||||
%{
|
||||
#if __GNUC__ >= 7
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include "conf-parser.h"
|
||||
#include "logind.h"
|
||||
|
@ -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"
|
||||
|
@ -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:
|
||||
|
@ -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) {
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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 "%%"
|
||||
|
@ -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"
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user