diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-16 03:17:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-16 06:14:59 +0200 |
commit | 44b601bc79e46722bc0f0862ee0ce34a2284ef11 (patch) | |
tree | c8825b4bdedf50d5b98b2e13a1f6a832f65626d9 /src/shared | |
parent | e0d856dd48d640f3d95efe7b769edec02373cc74 (diff) |
macro: clean up usage of gcc attributes
Always use our own macros, and name all our own macros the same style.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/conf-parser.h | 2 | ||||
-rw-r--r-- | src/shared/log.h | 10 | ||||
-rw-r--r-- | src/shared/macro.h | 2 | ||||
-rw-r--r-- | src/shared/strxcpyx.h | 8 | ||||
-rw-r--r-- | src/shared/util.h | 6 |
5 files changed, 15 insertions, 13 deletions
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 08428a514a..9435d54b11 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -114,7 +114,7 @@ int config_parse_set_status(const char *unit, const char *filename, unsigned lin int log_syntax_internal(const char *unit, int level, const char *file, unsigned line, const char *func, const char *config_file, unsigned config_line, - int error, const char *format, ...) _printf_attr_(9, 10); + int error, const char *format, ...) _printf_(9, 10); #define log_syntax(unit, level, config_file, config_line, error, ...) \ log_syntax_internal(unit, level, \ diff --git a/src/shared/log.h b/src/shared/log.h index 979f833d57..9ce99ef9fa 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -75,7 +75,7 @@ int log_meta( const char*file, int line, const char *func, - const char *format, ...) _printf_attr_(5,6); + const char *format, ...) _printf_(5,6); int log_metav( int level, @@ -83,7 +83,7 @@ int log_metav( int line, const char *func, const char *format, - va_list ap) _printf_attr_(5,0); + va_list ap) _printf_(5,0); int log_meta_object( int level, @@ -92,7 +92,7 @@ int log_meta_object( const char *func, const char *object_name, const char *object, - const char *format, ...) _printf_attr_(7,8); + const char *format, ...) _printf_(7,8); int log_metav_object( int level, @@ -102,14 +102,14 @@ int log_metav_object( const char *object_name, const char *object, const char *format, - va_list ap) _printf_attr_(7,0); + va_list ap) _printf_(7,0); int log_struct_internal( int level, const char *file, int line, const char *func, - const char *format, ...) _printf_attr_(5,0) _sentinel_; + const char *format, ...) _printf_(5,0) _sentinel_; int log_oom_internal( const char *file, diff --git a/src/shared/macro.h b/src/shared/macro.h index 06e16cd453..3cf17bb867 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -27,7 +27,7 @@ #include <sys/uio.h> #include <inttypes.h> -#define _printf_attr_(a,b) __attribute__ ((format (printf, a, b))) +#define _printf_(a,b) __attribute__ ((format (printf, a, b))) #define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__))) #define _sentinel_ __attribute__ ((sentinel)) #define _noreturn_ __attribute__((noreturn)) diff --git a/src/shared/strxcpyx.h b/src/shared/strxcpyx.h index 1229a4821d..7be246d570 100644 --- a/src/shared/strxcpyx.h +++ b/src/shared/strxcpyx.h @@ -24,8 +24,10 @@ #include <stdarg.h> #include <stdbool.h> +#include "macro.h" + size_t strpcpy(char **dest, size_t size, const char *src); -size_t strpcpyf(char **dest, size_t size, const char *src, ...) __attribute__((format(printf, 3, 4))); -size_t strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); +size_t strpcpyf(char **dest, size_t size, const char *src, ...) _printf_(3, 4); +size_t strpcpyl(char **dest, size_t size, const char *src, ...) _sentinel_; size_t strscpy(char *dest, size_t size, const char *src); -size_t strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); +size_t strscpyl(char *dest, size_t size, const char *src, ...) _sentinel_; diff --git a/src/shared/util.h b/src/shared/util.h index 86b21435b2..63cb4ac636 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -320,7 +320,7 @@ bool fstype_is_network(const char *fstype); int chvt(int vt); int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl); -int ask(char *ret, const char *replies, const char *text, ...) _printf_attr_(3, 4); +int ask(char *ret, const char *replies, const char *text, ...) _printf_(3, 4); int reset_terminal_fd(int fd, bool switch_to_text); int reset_terminal(const char *name); @@ -374,8 +374,8 @@ int pipe_eof(int fd); cpu_set_t* cpu_set_malloc(unsigned *ncpus); -int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_attr_(4,0); -int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_attr_(4,5); +int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_(4,0); +int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_(4,5); int status_welcome(void); int fd_columns(int fd); |