summaryrefslogtreecommitdiff
path: root/src/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemd')
-rw-r--r--src/systemd/sd-bus.h10
-rw-r--r--src/systemd/sd-daemon.h10
-rw-r--r--src/systemd/sd-journal.h24
3 files changed, 32 insertions, 12 deletions
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 36fab9ffa1..55648e0b34 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -32,6 +32,14 @@
extern "C" {
#endif
+#ifndef _sd_printf_attr_
+# if __GNUC__ >= 4
+# define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+# else
+# define _sd_printf_attr_(a,b)
+# endif
+#endif
+
/* TODO:
* - add page donation logic
* - api for appending/reading fixed arrays
@@ -187,7 +195,7 @@ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machi
#define SD_BUS_ERROR_MAKE(name, message) ((sd_bus_error) {(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, ...) _sd_printf_attr_(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-daemon.h b/src/systemd/sd-daemon.h
index fb7456d50f..daa3f4c857 100644
--- a/src/systemd/sd-daemon.h
+++ b/src/systemd/sd-daemon.h
@@ -68,11 +68,11 @@ extern "C" {
*/
#ifndef _sd_printf_attr_
-#if __GNUC__ >= 4
-#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
-#else
-#define _sd_printf_attr_(a,b)
-#endif
+# if __GNUC__ >= 4
+# define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+# else
+# define _sd_printf_attr_(a,b)
+# endif
#endif
/*
diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h
index 51653bafe9..5375d49963 100644
--- a/src/systemd/sd-journal.h
+++ b/src/systemd/sd-journal.h
@@ -34,19 +34,31 @@
extern "C" {
#endif
+#ifndef _sd_printf_attr_
+# if __GNUC__ >= 4
+# define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+# else
+# define _sd_printf_attr_(a,b)
+# endif
+#endif
+
+#ifndef _sd_sentinel_attr_
+# define _sd_sentinel_attr_ __attribute__((sentinel))
+#endif
+
/* Journal APIs. See sd-journal(3) for more information. */
/* 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_print(int priority, const char *format, ...) _sd_printf_attr_(2, 3);
+int sd_journal_printv(int priority, const char *format, va_list ap) _sd_printf_attr_(2, 0);
+int sd_journal_send(const char *format, ...) _sd_printf_attr_(1, 0) _sd_sentinel_attr_;
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_print_with_location(int priority, const char *file, const char *line, const char *func, const char *format, ...) _sd_printf_attr_(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) _sd_printf_attr_(5, 0);
+int sd_journal_send_with_location(const char *file, const char *line, const char *func, const char *format, ...) _sd_printf_attr_(4, 0) _sd_sentinel_attr_;
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);