]>
Commit | Line | Data |
---|---|---|
c1458549 AM |
1 | commit 848e863acc51ecfb0f3955c498874588201d9130 |
2 | Author: Franck Bui <fbui@suse.com> | |
3 | Date: Thu Mar 15 06:23:46 2018 +0100 | |
4 | ||
5 | basic/macros: rename noreturn into _noreturn_ (#8456) | |
6 | ||
7 | "noreturn" is reserved and can be used in other header files we include: | |
8 | ||
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); | |
14 | ||
15 | Here we include grcrypt.h (which in turns include gpg-error.h) *after* we | |
16 | "noreturn" was defined in macro.h. | |
17 | ||
18 | diff --git a/src/basic/log.c b/src/basic/log.c | |
19 | index 7a7f2cbec..16a2431c5 100644 | |
20 | --- a/src/basic/log.c | |
21 | +++ b/src/basic/log.c | |
22 | @@ -814,7 +814,7 @@ static void log_assert( | |
23 | log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer); | |
24 | } | |
25 | ||
26 | -noreturn void log_assert_failed_realm( | |
27 | +_noreturn_ void log_assert_failed_realm( | |
28 | LogRealm realm, | |
29 | const char *text, | |
30 | const char *file, | |
31 | @@ -826,7 +826,7 @@ noreturn void log_assert_failed_realm( | |
32 | abort(); | |
33 | } | |
34 | ||
35 | -noreturn void log_assert_failed_unreachable_realm( | |
36 | +_noreturn_ void log_assert_failed_unreachable_realm( | |
37 | LogRealm realm, | |
38 | const char *text, | |
39 | const char *file, | |
40 | diff --git a/src/basic/log.h b/src/basic/log.h | |
41 | index efcf0f1bf..314be128a 100644 | |
42 | --- a/src/basic/log.h | |
43 | +++ b/src/basic/log.h | |
44 | @@ -186,7 +186,7 @@ int log_dump_internal( | |
45 | char *buffer); | |
46 | ||
47 | /* Logging for various assertions */ | |
48 | -noreturn void log_assert_failed_realm( | |
49 | +_noreturn_ void log_assert_failed_realm( | |
50 | LogRealm realm, | |
51 | const char *text, | |
52 | const char *file, | |
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__) | |
56 | ||
57 | -noreturn void log_assert_failed_unreachable_realm( | |
58 | +_noreturn_ void log_assert_failed_unreachable_realm( | |
59 | LogRealm realm, | |
60 | const char *text, | |
61 | const char *file, | |
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 | |
66 | @@ -53,6 +53,15 @@ | |
67 | #else | |
68 | #define _fallthrough_ | |
69 | #endif | |
70 | +/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc | |
71 | + * compiler versions */ | |
72 | +#ifndef _noreturn_ | |
73 | +#if __STDC_VERSION__ >= 201112L | |
74 | +#define _noreturn_ _Noreturn | |
75 | +#else | |
76 | +#define _noreturn_ __attribute__((noreturn)) | |
77 | +#endif | |
78 | +#endif | |
79 | ||
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) { | |
83 | #endif | |
84 | #endif | |
85 | ||
86 | -/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc | |
87 | - * compiler versions */ | |
88 | -#ifndef noreturn | |
89 | -#if __STDC_VERSION__ >= 201112L | |
90 | -#define noreturn _Noreturn | |
91 | -#else | |
92 | -#define noreturn __attribute__((noreturn)) | |
93 | -#endif | |
94 | -#endif | |
95 | - | |
96 | #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ | |
97 | static inline void func##p(type *p) { \ | |
98 | if (*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) { | |
104 | return cached > 0; | |
105 | } | |
106 | ||
107 | -noreturn void freeze(void) { | |
108 | +_noreturn_ void freeze(void) { | |
109 | ||
110 | log_close(); | |
111 | ||
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); | |
117 | ||
118 | bool is_main_thread(void); | |
119 | ||
120 | -noreturn void freeze(void); | |
121 | +_noreturn_ void freeze(void); | |
122 | ||
123 | bool oom_score_adjust_is_valid(int oa); | |
124 | ||
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; | |
132 | ||
133 | -noreturn static void freeze_or_reboot(void) { | |
134 | +_noreturn_ static void freeze_or_reboot(void) { | |
135 | ||
136 | if (arg_crash_reboot) { | |
137 | log_notice("Rebooting in 10s..."); | |
138 | @@ -156,7 +156,7 @@ noreturn static void freeze_or_reboot(void) { | |
139 | freeze(); | |
140 | } | |
141 | ||
142 | -noreturn static void crash(int sig) { | |
143 | +_noreturn_ static void crash(int sig) { | |
144 | struct sigaction sa; | |
145 | pid_t pid; | |
146 | ||
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 | |
151 | @@ -37,7 +37,7 @@ | |
152 | ||
153 | static bool arg_keep = false; | |
154 | ||
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); | |
159 | abort(); | |
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; | |
167 | ||
168 | -noreturn static void pager_fallback(void) { | |
169 | +_noreturn_ static void pager_fallback(void) { | |
170 | int r; | |
171 | ||
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); | |
179 | } | |
180 | ||
181 | -noreturn static void sig_alrm(int signo) | |
182 | +_noreturn_ static void sig_alrm(int signo) | |
183 | { | |
184 | exit(4); | |
185 | } | |
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 | |
190 | ||
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 | |
193 | in the same code | |
194 | ||
195 | * (systemd) src/basic/missing.h contains another copy of MS_* constants | |
196 | ||
197 | The patch removes local systemd MS_* fallbacks, cleanup fs.h and | |
198 | mount.h include. | |
199 | ||
200 | Signed-off-by: Karel Zak <kzak@redhat.com> | |
201 | --- | |
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(-) | |
206 | ||
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 | |
213 | #endif | |
214 | ||
215 | -#ifndef MS_MOVE | |
216 | -#define MS_MOVE 8192 | |
217 | -#endif | |
218 | - | |
219 | -#ifndef MS_REC | |
220 | -#define MS_REC 16384 | |
221 | -#endif | |
222 | - | |
223 | -#ifndef MS_PRIVATE | |
224 | -#define MS_PRIVATE (1<<18) | |
225 | -#endif | |
226 | - | |
227 | -#ifndef MS_REC | |
228 | -#define MS_REC (1<<19) | |
229 | -#endif | |
230 | - | |
231 | -#ifndef MS_SHARED | |
232 | -#define MS_SHARED (1<<20) | |
233 | -#endif | |
234 | - | |
235 | -#ifndef MS_RELATIME | |
236 | -#define MS_RELATIME (1<<21) | |
237 | -#endif | |
238 | - | |
239 | -#ifndef MS_KERNMOUNT | |
240 | -#define MS_KERNMOUNT (1<<22) | |
241 | -#endif | |
242 | - | |
243 | -#ifndef MS_I_VERSION | |
244 | -#define MS_I_VERSION (1<<23) | |
245 | -#endif | |
246 | - | |
247 | -#ifndef MS_STRICTATIME | |
248 | -#define MS_STRICTATIME (1<<24) | |
249 | -#endif | |
250 | - | |
251 | -#ifndef MS_LAZYTIME | |
252 | -#define MS_LAZYTIME (1<<25) | |
253 | -#endif | |
254 | - | |
255 | #ifndef SCM_SECURITY | |
256 | #define SCM_SECURITY 0x03 | |
257 | #endif | |
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 | |
262 | @@ -21,7 +21,6 @@ | |
263 | ||
264 | #include <errno.h> | |
265 | #include <fcntl.h> | |
266 | -#include <linux/fs.h> | |
267 | #include <linux/oom.h> | |
268 | #if HAVE_SECCOMP | |
269 | #include <seccomp.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 | |
274 | @@ -52,6 +52,8 @@ | |
275 | #include "utf8.h" | |
276 | #include "util.h" | |
277 | ||
278 | +#include <sys/mount.h> | |
279 | + | |
280 | int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { | |
281 | assert(message); | |
282 | assert(u); |