Merge pull request #5166 from keszybz/gcc7

Fixes for gcc 7 and new µhttpd & glibc warnings
This commit is contained in:
Evgeny Vereshchagin 2017-02-01 12:02:50 +03:00 committed by GitHub
commit b5267219dd
15 changed files with 49 additions and 22 deletions

View file

@ -69,9 +69,9 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
switch(len)
{
case 3: h ^= data[2] << 16;
case 2: h ^= data[1] << 8;
case 1: h ^= data[0];
case 3: h ^= data[2] << 16; /* fall through */
case 2: h ^= data[1] << 8; /* fall through */
case 1: h ^= data[0]; /* fall through */
h *= m;
};

View file

@ -27,6 +27,10 @@
#define NSS_SIGNALS_BLOCK SIGALRM,SIGVTALRM,SIGPIPE,SIGCHLD,SIGTSTP,SIGIO,SIGHUP,SIGUSR1,SIGUSR2,SIGPROF,SIGURG,SIGWINCH
#ifndef DEPRECATED_RES_USE_INET6
# define DEPRECATED_RES_USE_INET6 0x00002000
#endif
#define NSS_GETHOSTBYNAME_PROTOTYPES(module) \
enum nss_status _nss_##module##_gethostbyname4_r( \
const char *name, \
@ -92,7 +96,7 @@ enum nss_status _nss_##module##_gethostbyname_r( \
int *errnop, int *h_errnop) { \
enum nss_status ret = NSS_STATUS_NOTFOUND; \
\
if (_res.options & RES_USE_INET6) \
if (_res.options & DEPRECATED_RES_USE_INET6) \
ret = _nss_##module##_gethostbyname3_r( \
name, \
AF_INET6, \

View 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;
}

View 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 */

View file

@ -697,7 +697,7 @@ _pure_ static const char *job_get_status_message_format(Unit *u, JobType t, JobR
static void job_print_status_message(Unit *u, JobType t, JobResult result) {
static const struct {
const char *color, *word;
} const statuses[_JOB_RESULT_MAX] = {
} statuses[_JOB_RESULT_MAX] = {
[JOB_DONE] = { ANSI_GREEN, " OK " },
[JOB_TIMEOUT] = { ANSI_HIGHLIGHT_RED, " TIME " },
[JOB_FAILED] = { ANSI_HIGHLIGHT_RED, "FAILED" },

View 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;
}

View 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;

View file

@ -1029,10 +1029,9 @@ int main(int argc, char *argv[]) {
{ MHD_OPTION_END, 0, NULL }};
int opts_pos = 2;
/* We force MHD_USE_PIPE_FOR_SHUTDOWN here, in order
* to make sure libmicrohttpd doesn't use shutdown()
* on our listening socket, which would break socket
* re-activation. See
/* We force MHD_USE_ITC here, in order to make sure
* libmicrohttpd doesn't use shutdown() on our listening
* socket, which would break socket re-activation. See
*
* https://lists.gnu.org/archive/html/libmicrohttpd/2015-09/msg00014.html
* https://github.com/systemd/systemd/pull/1286
@ -1041,7 +1040,7 @@ int main(int argc, char *argv[]) {
int flags =
MHD_USE_DEBUG |
MHD_USE_DUAL_STACK |
MHD_USE_PIPE_FOR_SHUTDOWN |
MHD_USE_ITC |
MHD_USE_POLL |
MHD_USE_THREAD_PER_CONNECTION;

View file

@ -648,9 +648,9 @@ static int setup_microhttpd_server(RemoteServer *s,
int flags =
MHD_USE_DEBUG |
MHD_USE_DUAL_STACK |
MHD_USE_EPOLL_LINUX_ONLY |
MHD_USE_EPOLL |
MHD_USE_PEDANTIC_CHECKS |
MHD_USE_PIPE_FOR_SHUTDOWN;
MHD_USE_ITC;
const union MHD_DaemonInfo *info;
int r, epoll_fd;

View file

@ -24,13 +24,25 @@
#include "macro.h"
/* Those defines are added when options are renamed, hence the check for the *old* name. */
/* Compatiblity with libmicrohttpd < 0.9.38 */
#ifndef MHD_HTTP_NOT_ACCEPTABLE
#define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
# define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
#endif
/* Renamed in µhttpd 0.9.52 */
#ifndef MHD_USE_EPOLL_LINUX_ONLY
# define MHD_USE_EPOLL MHD_USE_EPOLL_LINUX_ONLY
#endif
/* Renamed in µhttpd 0.9.51 */
#ifndef MHD_USE_PIPE_FOR_SHUTDOWN
# define MHD_USE_ITC MHD_USE_PIPE_FOR_SHUTDOWN
#endif
#if MHD_VERSION < 0x00094203
#define MHD_create_response_from_fd_at_offset64 MHD_create_response_from_fd_at_offset
# define MHD_create_response_from_fd_at_offset64 MHD_create_response_from_fd_at_offset
#endif
void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0);

View 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;

View file

@ -48,6 +48,10 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
# include <endian.h> /* attempt to define endianness */
#endif
#if __GNUC__ >= 7
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
#endif
/*
* My best guess at if you are big-endian or little-endian. This may
* need adjustment.

View 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:

View 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';

View file

@ -676,9 +676,8 @@ static int parse_argv(int argc, char *argv[]) {
r = free_and_strdup(&arg_machine, optarg);
if (r < 0)
return log_oom();
break;
}
break;
case 'Z':
arg_selinux_context = optarg;
@ -1918,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));