summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-03-15 06:23:46 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-03-15 14:23:46 +0900
commit848e863acc51ecfb0f3955c498874588201d9130 (patch)
treefedd8948ff6e083243b591df36d723340a457096 /src/basic
parent3b71cf46bee9364323c6bfb7018210d8f35f5820 (diff)
downloadsystemd-848e863acc51ecfb0f3955c498874588201d9130.tar.gz
basic/macros: rename noreturn into _noreturn_ (#8456)
"noreturn" is reserved and can be used in other header files we include: [ 16s] In file included from /usr/include/gcrypt.h:30:0, [ 16s] from ../src/journal/journal-file.h:26, [ 16s] from ../src/journal/journal-vacuum.c:31: [ 16s] /usr/include/gpg-error.h:1544:46: error: expected ‘,’ or ‘;’ before ‘)’ token [ 16s] void gpgrt_log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); Here we include grcrypt.h (which in turns include gpg-error.h) *after* we "noreturn" was defined in macro.h.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/log.c4
-rw-r--r--src/basic/log.h4
-rw-r--r--src/basic/macro.h19
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/basic/process-util.h2
5 files changed, 15 insertions, 16 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index 7a7f2cbec1..16a2431c54 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -814,7 +814,7 @@ static void log_assert(
log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer);
}
-noreturn void log_assert_failed_realm(
+_noreturn_ void log_assert_failed_realm(
LogRealm realm,
const char *text,
const char *file,
@@ -826,7 +826,7 @@ noreturn void log_assert_failed_realm(
abort();
}
-noreturn void log_assert_failed_unreachable_realm(
+_noreturn_ void log_assert_failed_unreachable_realm(
LogRealm realm,
const char *text,
const char *file,
diff --git a/src/basic/log.h b/src/basic/log.h
index efcf0f1bfc..314be128a2 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -186,7 +186,7 @@ int log_dump_internal(
char *buffer);
/* Logging for various assertions */
-noreturn void log_assert_failed_realm(
+_noreturn_ void log_assert_failed_realm(
LogRealm realm,
const char *text,
const char *file,
@@ -195,7 +195,7 @@ noreturn void log_assert_failed_realm(
#define log_assert_failed(text, ...) \
log_assert_failed_realm(LOG_REALM, (text), __VA_ARGS__)
-noreturn void log_assert_failed_unreachable_realm(
+_noreturn_ void log_assert_failed_unreachable_realm(
LogRealm realm,
const char *text,
const char *file,
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 95be63a204..8911edfc4b 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -53,6 +53,15 @@
#else
#define _fallthrough_
#endif
+/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
+ * compiler versions */
+#ifndef _noreturn_
+#if __STDC_VERSION__ >= 201112L
+#define _noreturn_ _Noreturn
+#else
+#define _noreturn_ __attribute__((noreturn))
+#endif
+#endif
/* Temporarily disable some warnings */
#define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT \
@@ -414,16 +423,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
#endif
#endif
-/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
- * compiler versions */
-#ifndef noreturn
-#if __STDC_VERSION__ >= 201112L
-#define noreturn _Noreturn
-#else
-#define noreturn __attribute__((noreturn))
-#endif
-#endif
-
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index aa9846db5d..e6120af5b6 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -987,7 +987,7 @@ bool is_main_thread(void) {
return cached > 0;
}
-noreturn void freeze(void) {
+_noreturn_ void freeze(void) {
log_close();
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 93029e36e5..5170adec7b 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -91,7 +91,7 @@ int pid_from_same_root_fs(pid_t pid);
bool is_main_thread(void);
-noreturn void freeze(void);
+_noreturn_ void freeze(void);
bool oom_score_adjust_is_valid(int oa);