1 commit 848e863acc51ecfb0f3955c498874588201d9130
2 Author: Franck Bui <fbui@suse.com>
3 Date: Thu Mar 15 06:23:46 2018 +0100
5 basic/macros: rename noreturn into _noreturn_ (#8456)
7 "noreturn" is reserved and can be used in other header files we include:
9 [ 16s] In file included from /usr/include/gcrypt.h:30:0,
10 [ 16s] from ../src/journal/journal-file.h:26,
11 [ 16s] from ../src/journal/journal-vacuum.c:31:
12 [ 16s] /usr/include/gpg-error.h:1544:46: error: expected ‘,’ or ‘;’ before ‘)’ token
13 [ 16s] void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2);
15 Here we include grcrypt.h (which in turns include gpg-error.h) *after* we
16 "noreturn" was defined in macro.h.
18 diff --git a/src/basic/log.c b/src/basic/log.c
19 index 7a7f2cbec..16a2431c5 100644
22 @@ -814,7 +814,7 @@ static void log_assert(
23 log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer);
26 -noreturn void log_assert_failed_realm(
27 +_noreturn_ void log_assert_failed_realm(
31 @@ -826,7 +826,7 @@ noreturn void log_assert_failed_realm(
35 -noreturn void log_assert_failed_unreachable_realm(
36 +_noreturn_ void log_assert_failed_unreachable_realm(
40 diff --git a/src/basic/log.h b/src/basic/log.h
41 index efcf0f1bf..314be128a 100644
44 @@ -186,7 +186,7 @@ int log_dump_internal(
47 /* Logging for various assertions */
48 -noreturn void log_assert_failed_realm(
49 +_noreturn_ void log_assert_failed_realm(
53 @@ -195,7 +195,7 @@ noreturn void log_assert_failed_realm(
54 #define log_assert_failed(text, ...) \
55 log_assert_failed_realm(LOG_REALM, (text), __VA_ARGS__)
57 -noreturn void log_assert_failed_unreachable_realm(
58 +_noreturn_ void log_assert_failed_unreachable_realm(
62 diff --git a/src/basic/macro.h b/src/basic/macro.h
63 index 95be63a20..8911edfc4 100644
64 --- a/src/basic/macro.h
65 +++ b/src/basic/macro.h
70 +/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
71 + * compiler versions */
73 +#if __STDC_VERSION__ >= 201112L
74 +#define _noreturn_ _Noreturn
76 +#define _noreturn_ __attribute__((noreturn))
80 /* Temporarily disable some warnings */
81 #define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT \
82 @@ -414,16 +423,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
86 -/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
87 - * compiler versions */
89 -#if __STDC_VERSION__ >= 201112L
90 -#define noreturn _Noreturn
92 -#define noreturn __attribute__((noreturn))
96 #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
97 static inline void func##p(type *p) { \
99 diff --git a/src/basic/process-util.c b/src/basic/process-util.c
100 index aa9846db5..e6120af5b 100644
101 --- a/src/basic/process-util.c
102 +++ b/src/basic/process-util.c
103 @@ -987,7 +987,7 @@ bool is_main_thread(void) {
107 -noreturn void freeze(void) {
108 +_noreturn_ void freeze(void) {
112 diff --git a/src/basic/process-util.h b/src/basic/process-util.h
113 index 93029e36e..5170adec7 100644
114 --- a/src/basic/process-util.h
115 +++ b/src/basic/process-util.h
116 @@ -91,7 +91,7 @@ int pid_from_same_root_fs(pid_t pid);
118 bool is_main_thread(void);
120 -noreturn void freeze(void);
121 +_noreturn_ void freeze(void);
123 bool oom_score_adjust_is_valid(int oa);
125 diff --git a/src/core/main.c b/src/core/main.c
126 index 076846a41..4b2d14923 100644
127 --- a/src/core/main.c
128 +++ b/src/core/main.c
129 @@ -141,7 +141,7 @@ static uint64_t arg_default_tasks_max = UINT64_MAX;
130 static sd_id128_t arg_machine_id = {};
131 static EmergencyAction arg_cad_burst_action = EMERGENCY_ACTION_REBOOT_FORCE;
133 -noreturn static void freeze_or_reboot(void) {
134 +_noreturn_ static void freeze_or_reboot(void) {
136 if (arg_crash_reboot) {
137 log_notice("Rebooting in 10s...");
138 @@ -156,7 +156,7 @@ noreturn static void freeze_or_reboot(void) {
142 -noreturn static void crash(int sig) {
143 +_noreturn_ static void crash(int sig) {
147 diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
148 index 5a88b2774..d87bdbdd3 100644
149 --- a/src/journal/test-journal-interleaving.c
150 +++ b/src/journal/test-journal-interleaving.c
153 static bool arg_keep = false;
155 -noreturn static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) {
156 +_noreturn_ static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) {
157 log_internal(LOG_CRIT, error, file, line, func,
158 "'%s' failed at %s:%u (%s): %m", text, file, line, func);
160 diff --git a/src/shared/pager.c b/src/shared/pager.c
161 index 75db3c985..681af9c40 100644
162 --- a/src/shared/pager.c
163 +++ b/src/shared/pager.c
164 @@ -47,7 +47,7 @@ static int stored_stderr = -1;
165 static bool stdout_redirected = false;
166 static bool stderr_redirected = false;
168 -noreturn static void pager_fallback(void) {
169 +_noreturn_ static void pager_fallback(void) {
172 r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (uint64_t) -1, 0);
173 diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
174 index 2821640e9..c8fa47b3d 100644
175 --- a/src/udev/collect/collect.c
176 +++ b/src/udev/collect/collect.c
177 @@ -58,7 +58,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *node)
178 return container_of(node, struct _mate, node);
181 -noreturn static void sig_alrm(int signo)
182 +_noreturn_ static void sig_alrm(int signo)
186 From eb50b6d936c474f5bc2974c059f6432222af4de4 Mon Sep 17 00:00:00 2001
187 From: Karel Zak <kzak@redhat.com>
188 Date: Thu, 22 Mar 2018 12:50:45 +0100
189 Subject: [PATCH] Fix linux/fs.h and sys/mount.h collisions
191 * (kernel-headers) linux/fs.h and (glibc) sys/mount.h contains MS_* constants
192 and because it's without #ifdefs you cannot include the both files together
195 * (systemd) src/basic/missing.h contains another copy of MS_* constants
197 The patch removes local systemd MS_* fallbacks, cleanup fs.h and
200 Signed-off-by: Karel Zak <kzak@redhat.com>
202 src/basic/missing.h | 40 ----------------------------------------
203 src/core/load-fragment.c | 1 -
204 src/shared/bus-unit-util.c | 2 ++
205 3 files changed, 2 insertions(+), 41 deletions(-)
207 diff --git a/src/basic/missing.h b/src/basic/missing.h
208 index 567aea8da9c..6802dd27c7b 100644
209 --- a/src/basic/missing.h
210 +++ b/src/basic/missing.h
211 @@ -524,46 +524,6 @@ struct btrfs_ioctl_quota_ctl_args {
212 #define OCFS2_SUPER_MAGIC 0x7461636f
216 -#define MS_MOVE 8192
220 -#define MS_REC 16384
224 -#define MS_PRIVATE (1<<18)
228 -#define MS_REC (1<<19)
232 -#define MS_SHARED (1<<20)
236 -#define MS_RELATIME (1<<21)
239 -#ifndef MS_KERNMOUNT
240 -#define MS_KERNMOUNT (1<<22)
243 -#ifndef MS_I_VERSION
244 -#define MS_I_VERSION (1<<23)
247 -#ifndef MS_STRICTATIME
248 -#define MS_STRICTATIME (1<<24)
252 -#define MS_LAZYTIME (1<<25)
256 #define SCM_SECURITY 0x03
258 diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
259 index 94605ab0d02..49f8a8c6da1 100644
260 --- a/src/core/load-fragment.c
261 +++ b/src/core/load-fragment.c
266 -#include <linux/fs.h>
267 #include <linux/oom.h>
270 diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
271 index 23e05daf48c..6e7ea10e714 100644
272 --- a/src/shared/bus-unit-util.c
273 +++ b/src/shared/bus-unit-util.c
278 +#include <sys/mount.h>
280 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {