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 | |
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')
-rw-r--r-- | src/core/execute.c | 2 | ||||
-rw-r--r-- | src/core/manager.h | 2 | ||||
-rw-r--r-- | src/core/selinux-access.c | 2 | ||||
-rw-r--r-- | src/core/unit.h | 8 | ||||
-rw-r--r-- | src/journal/journal-send.c | 2 | ||||
-rw-r--r-- | src/journal/journald-server.h | 2 | ||||
-rw-r--r-- | src/journal/microhttpd-util.h | 2 | ||||
-rw-r--r-- | src/libudev/libudev-private.h | 6 | ||||
-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 | ||||
-rw-r--r-- | src/udev/udev.h | 2 |
14 files changed, 29 insertions, 27 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index b48b1ae513..8f09233e3e 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -511,7 +511,7 @@ fail: return r; } -_printf_attr_(1, 2) static int write_confirm_message(const char *format, ...) { +_printf_(1, 2) static int write_confirm_message(const char *format, ...) { int fd; va_list ap; diff --git a/src/core/manager.h b/src/core/manager.h index a3049b5e5b..ffcca48a3d 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -318,7 +318,7 @@ void manager_undo_generators(Manager *m); void manager_recheck_journal(Manager *m); void manager_set_show_status(Manager *m, bool b); -void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_attr_(4,5); +void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_(4,5); Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path); diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c index 0a3ee18bb9..c7e951cde6 100644 --- a/src/core/selinux-access.c +++ b/src/core/selinux-access.c @@ -174,7 +174,7 @@ static int audit_callback( user_avc's into the /var/log/audit/audit.log, otherwise they will be sent to syslog. */ -_printf_attr_(2, 3) static int log_callback(int type, const char *fmt, ...) { +_printf_(2, 3) static int log_callback(int type, const char *fmt, ...) { va_list ap; va_start(ap, fmt); diff --git a/src/core/unit.h b/src/core/unit.h index 6dd750f8c2..6971048a9b 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -549,7 +549,7 @@ int unit_get_related_unit(Unit *u, const char *type, Unit **_found); bool unit_can_serialize(Unit *u) _pure_; int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs); -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_(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); @@ -557,7 +557,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants); int unit_coldplug(Unit *u); -void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_attr_(3, 0); +void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_(3, 0); bool unit_need_daemon_reload(Unit *u); @@ -598,10 +598,10 @@ ExecContext *unit_get_exec_context(Unit *u) _pure_; CGroupContext *unit_get_cgroup_context(Unit *u) _pure_; int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *data); -int unit_write_drop_in_format(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *format, ...) _printf_attr_(4,5); +int unit_write_drop_in_format(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *format, ...) _printf_(4,5); int unit_write_drop_in_private(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *data); -int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *format, ...) _printf_attr_(4,5); +int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const char *name, const char *format, ...) _printf_(4,5); int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name); diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index d00e26f1eb..52f9905c4e 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -111,7 +111,7 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) { return sd_journal_sendv(iov, 2); } -_printf_attr_(1, 0) static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct iovec **_iov) { +_printf_(1, 0) static int fill_iovec_sprintf(const char *format, va_list ap, int extra, struct iovec **_iov) { PROTECT_ERRNO; int r, n = 0, i = 0, j; struct iovec *iov = NULL; diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h index 10e9958be0..069cd173c8 100644 --- a/src/journal/journald-server.h +++ b/src/journal/journald-server.h @@ -128,7 +128,7 @@ typedef struct Server { #define N_IOVEC_OBJECT_FIELDS 11 void server_dispatch_message(Server *s, struct iovec *iovec, unsigned n, unsigned m, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len, const char *unit_id, int priority, pid_t object_pid); -void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...) _printf_attr_(3,4); +void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...) _printf_(3,4); /* gperf lookup function */ const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length); diff --git a/src/journal/microhttpd-util.h b/src/journal/microhttpd-util.h index 20ad76990c..74d1668bdf 100644 --- a/src/journal/microhttpd-util.h +++ b/src/journal/microhttpd-util.h @@ -25,4 +25,4 @@ #include "macro.h" -void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_attr_(2, 0); +void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0); diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h index 54c51acc23..18bc853a5a 100644 --- a/src/libudev/libudev-private.h +++ b/src/libudev/libudev-private.h @@ -48,8 +48,7 @@ /* libudev.c */ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, - const char *format, ...) - __attribute__((format(printf, 6, 7))); + const char *format, ...) _printf_(6, 7); int udev_get_rules_path(struct udev *udev, char **path[], usec_t *ts_usec[]); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); @@ -175,5 +174,6 @@ int util_delete_path(struct udev *udev, const char *path); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); -ssize_t print_kmsg(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +ssize_t print_kmsg(const char *fmt, ...) _printf_(1, 2); + #endif 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); diff --git a/src/udev/udev.h b/src/udev/udev.h index ed8b1834ca..29e96d637e 100644 --- a/src/udev/udev.h +++ b/src/udev/udev.h @@ -201,7 +201,7 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev, const char *prefix, const /* udev logging */ void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, - const char *format, va_list args) _printf_attr_(6, 0); + const char *format, va_list args) _printf_(6, 0); /* udevadm commands */ struct udevadm_cmd { |