diff --git a/src/core/execute.c b/src/core/execute.c index b48b1ae513b..8f09233e3ea 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 a3049b5e5b6..ffcca48a3d0 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 0a3ee18bb9b..c7e951cde6e 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 6dd750f8c21..6971048a9b0 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 d00e26f1eb7..52f9905c4e3 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 10e9958be02..069cd173c8d 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 20ad76990c1..74d1668bdfc 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 54c51acc230..18bc853a5a7 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 08428a514a9..9435d54b11c 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 979f833d571..9ce99ef9fa4 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 06e16cd4536..3cf17bb8675 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -27,7 +27,7 @@ #include #include -#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 1229a4821df..7be246d570d 100644 --- a/src/shared/strxcpyx.h +++ b/src/shared/strxcpyx.h @@ -24,8 +24,10 @@ #include #include +#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 86b21435b2d..63cb4ac6369 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 ed8b1834ca9..29e96d637e7 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 {