From 93a46b0bc51cf2beb8523830ef7fd74aa0869673 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 Jun 2010 21:34:03 +0200 Subject: [PATCH] macro: avoid name clash with _unused on ppc --- src/log.c | 2 +- src/log.h | 6 +++--- src/macro.h | 28 ++++++++++++++-------------- src/main.c | 4 ++-- src/strv.h | 16 ++++++++-------- src/unit.h | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/log.c b/src/log.c index 1343b9d9..04ffb629 100644 --- a/src/log.c +++ b/src/log.c @@ -368,7 +368,7 @@ int log_meta( int saved_errno, r; va_list ap; - if (_likely(LOG_PRI(level) > log_max_level)) + if (_likely_(LOG_PRI(level) > log_max_level)) return 0; saved_errno = errno; diff --git a/src/log.h b/src/log.h index 6df1d599..0370cb90 100644 --- a/src/log.h +++ b/src/log.h @@ -59,13 +59,13 @@ int log_meta( const char*file, int line, const char *func, - const char *format, ...) _printf_attr(5,6); + const char *format, ...) _printf_attr_(5,6); -_noreturn void log_assert( +_noreturn_ void log_assert( const char*file, int line, const char *func, - const char *format, ...) _printf_attr(4,5); + const char *format, ...) _printf_attr_(4,5); #define log_debug(...) log_meta(LOG_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__) #define log_info(...) log_meta(LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__) diff --git a/src/macro.h b/src/macro.h index 622c08ee..763a4de2 100644 --- a/src/macro.h +++ b/src/macro.h @@ -25,19 +25,19 @@ #include #include -#define _printf_attr(a,b) __attribute__ ((format (printf, a, b))) -#define _sentinel __attribute__ ((sentinel)) -#define _noreturn __attribute__((noreturn)) -#define _unused __attribute__ ((unused)) -#define _destructor __attribute__ ((destructor)) -#define _pure __attribute__ ((pure)) -#define _const __attribute__ ((const)) -#define _deprecated __attribute__ ((deprecated)) -#define _packed __attribute__ ((packed)) -#define _malloc __attribute__ ((malloc)) -#define _weak __attribute__ ((weak)) -#define _likely(x) (__builtin_expect(!!(x),1)) -#define _unlikely(x) (__builtin_expect(!!(x),0)) +#define _printf_attr_(a,b) __attribute__ ((format (printf, a, b))) +#define _sentinel_ __attribute__ ((sentinel)) +#define _noreturn_ __attribute__((noreturn)) +#define _unused_ __attribute__ ((unused)) +#define _destructor_ __attribute__ ((destructor)) +#define _pure_ __attribute__ ((pure)) +#define _const_ __attribute__ ((const)) +#define _deprecated_ __attribute__ ((deprecated)) +#define _packed_ __attribute__ ((packed)) +#define _malloc_ __attribute__ ((malloc)) +#define _weak_ __attribute__ ((weak)) +#define _likely_(x) (__builtin_expect(!!(x),1)) +#define _unlikely_(x) (__builtin_expect(!!(x),0)) /* Rounds up */ static inline size_t ALIGN(size_t l) { @@ -70,7 +70,7 @@ static inline size_t ALIGN(size_t l) { #define assert_se(expr) \ do { \ - if (_unlikely(!(expr))) \ + if (_unlikely_(!(expr))) \ log_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ "Assertion '%s' failed at %s:%u, function %s(). Aborting.", \ #expr , __FILE__, __LINE__, __PRETTY_FUNCTION__); \ diff --git a/src/main.c b/src/main.c index 7a829cea..7c93f6d9 100644 --- a/src/main.c +++ b/src/main.c @@ -58,7 +58,7 @@ static int crash_chvt = -1; static bool confirm_spawn = false; static FILE* serialization = NULL; -_noreturn static void freeze(void) { +_noreturn_ static void freeze(void) { for (;;) pause(); } @@ -66,7 +66,7 @@ _noreturn static void freeze(void) { static void nop_handler(int sig) { } -_noreturn static void crash(int sig) { +_noreturn_ static void crash(int sig) { if (!dump_core) log_error("Caught <%s>, not dumping core.", strsignal(sig)); diff --git a/src/strv.h b/src/strv.h index f0be83dd..11d2ea12 100644 --- a/src/strv.h +++ b/src/strv.h @@ -29,7 +29,7 @@ char *strv_find(char **l, const char *name); void strv_free(char **l); -char **strv_copy(char **l) _malloc; +char **strv_copy(char **l) _malloc_; unsigned strv_length(char **l); char **strv_merge(char **a, char **b); @@ -41,20 +41,20 @@ char **strv_uniq(char **l); #define strv_contains(l, s) (!!strv_find((l), (s))) -char **strv_new(const char *x, ...) _sentinel _malloc; -char **strv_new_ap(const char *x, va_list ap) _malloc; +char **strv_new(const char *x, ...) _sentinel_ _malloc_; +char **strv_new_ap(const char *x, va_list ap) _malloc_; static inline bool strv_isempty(char **l) { return !l || !*l; } -char **strv_split(const char *s, const char *separator) _malloc; -char **strv_split_quoted(const char *s) _malloc; +char **strv_split(const char *s, const char *separator) _malloc_; +char **strv_split_quoted(const char *s) _malloc_; -char *strv_join(char **l, const char *separator) _malloc; +char *strv_join(char **l, const char *separator) _malloc_; -char **strv_env_merge(char **x, ...) _sentinel; -char **strv_env_delete(char **x, ...) _sentinel; +char **strv_env_merge(char **x, ...) _sentinel_; +char **strv_env_delete(char **x, ...) _sentinel_; #define STRV_FOREACH(s, l) \ for ((s) = (l); (s) && *(s); (s)++) diff --git a/src/unit.h b/src/unit.h index f585fa62..d3e6e890 100644 --- a/src/unit.h +++ b/src/unit.h @@ -431,7 +431,7 @@ char **unit_full_printf_strv(Unit *u, char **l); bool unit_can_serialize(Unit *u); int unit_serialize(Unit *u, FILE *f, FDSet *fds); -void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_attr(4,5); +void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_attr_(4,5); void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value); int unit_deserialize(Unit *u, FILE *f, FDSet *fds); -- 2.39.5