[systemd-devel] [PATCH] Add some extra __attribute__ ((format)) s
Cristian Rodríguez
crrodriguez at opensuse.org
Tue Apr 2 00:02:58 PDT 2013
diff --git a/src/core/manager.h b/src/core/manager.h
index 9d8d943..cd1ef23 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -301,6 +301,6 @@ 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, ...);
+void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_attr_(4,5);
void watch_init(Watch *w);
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index 21edd6b..ffcf2f3 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -130,7 +130,7 @@ typedef struct Server {
#define N_IOVEC_UDEV_FIELDS 32
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);
-void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...);
+void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...) _printf_attr_(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 d4fefa7..36c7c10 100644
--- a/src/journal/microhttpd-util.h
+++ b/src/journal/microhttpd-util.h
@@ -23,4 +23,4 @@
#include <stdarg.h>
-void microhttpd_logger(void *arg, const char *fmt, va_list ap);
+void microhttpd_logger(void *arg, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0)));
diff --git a/src/shared/log.h b/src/shared/log.h
index 9aafcb4..5fc8988 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -83,7 +83,7 @@ int log_metav(
int line,
const char *func,
const char *format,
- va_list ap);
+ va_list ap) _printf_attr_(5,0);
int log_meta_object(
int level,
@@ -102,14 +102,14 @@ int log_metav_object(
const char *object_name,
const char *object,
const char *format,
- va_list ap);
+ va_list ap) _printf_attr_(7,0);
int log_struct_internal(
int level,
const char *file,
int line,
const char *func,
- const char *format, ...) _sentinel_;
+ const char *format, ...) _printf_attr_(5,0) _sentinel_;
int log_oom_internal(
const char *file,
diff --git a/src/shared/util.h b/src/shared/util.h
index d1cdd90..78d8220 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -359,8 +359,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);
-int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...);
+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_welcome(void);
int fd_columns(int fd);
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 057931d..6afd79c 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -161,7 +161,7 @@ int sd_bus_get_owner_pid(sd_bus *bus, const char *name, pid_t *pid);
#define SD_BUS_ERROR_INIT_CONST(name, message) {(name), (message), 0}
void sd_bus_error_free(sd_bus_error *e);
-int sd_bus_error_set(sd_bus_error *e, const char *name, const char *format, ...);
+int sd_bus_error_set(sd_bus_error *e, const char *name, const char *format, ...) __attribute__ ((format (printf, 3, 0)));
void sd_bus_error_set_const(sd_bus_error *e, const char *name, const char *message);
int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e);
int sd_bus_error_is_set(const sd_bus_error *e);
diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h
index 2e8d2d8..c624da1 100644
--- a/src/systemd/sd-journal.h
+++ b/src/systemd/sd-journal.h
@@ -38,15 +38,15 @@ extern "C" {
/* Write to daemon */
int sd_journal_print(int priority, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
-int sd_journal_printv(int priority, const char *format, va_list ap);
-int sd_journal_send(const char *format, ...) __attribute__((sentinel));
+int sd_journal_printv(int priority, const char *format, va_list ap) __attribute__ ((format (printf, 2, 0)));
+int sd_journal_send(const char *format, ...) __attribute__ ((format (printf, 1, 0))) __attribute__((sentinel));
int sd_journal_sendv(const struct iovec *iov, int n);
int sd_journal_perror(const char *message);
/* Used by the macros below. Don't call this directly. */
int sd_journal_print_with_location(int priority, const char *file, const char *line, const char *func, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
-int sd_journal_printv_with_location(int priority, const char *file, const char *line, const char *func, const char *format, va_list ap);
-int sd_journal_send_with_location(const char *file, const char *line, const char *func, const char *format, ...) __attribute__((sentinel));
+int sd_journal_printv_with_location(int priority, const char *file, const char *line, const char *func, const char *format, va_list ap) __attribute__ ((format (printf, 5, 0)));
+int sd_journal_send_with_location(const char *file, const char *line, const char *func, const char *format, ...) __attribute__ ((format (printf, 4, 0))) __attribute__((sentinel));
int sd_journal_sendv_with_location(const char *file, const char *line, const char *func, const struct iovec *iov, int n);
int sd_journal_perror_with_location(const char *file, const char *line, const char *func, const char *message);
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 906dfba..e0076a3 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -195,7 +195,7 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev, const char *modalias, bool
/* 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);
+ const char *format, va_list args) __attribute__ ((format (printf, 6, 0))) ;
/* udevadm commands */
struct udevadm_cmd {
--
1.8.1.4
More information about the systemd-devel
mailing list