mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 01:27:11 +03:00
macro: clean up usage of gcc attributes
Always use our own macros, and name all our own macros the same style.
This commit is contained in:
parent
e0d856dd48
commit
44b601bc79
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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, \
|
||||
|
@ -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,
|
||||
|
@ -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))
|
||||
|
@ -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_;
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user