From: Simon McVittie Date: Fri, 7 Oct 2016 18:45:48 +0000 (+0100) Subject: Add missing function attributes suggested by clang (but not by gcc) X-Git-Tag: dbus-1.11.8~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7959d907197d2f674e0bf295341ff3f997628d8f;p=thirdparty%2Fdbus.git Add missing function attributes suggested by clang (but not by gcc) clang is a little more enthusiastic about suggesting these. Signed-off-by: Simon McVittie --- diff --git a/bus/main.c b/bus/main.c index a325cea07..5e26820ae 100644 --- a/bus/main.c +++ b/bus/main.c @@ -132,6 +132,8 @@ signal_handler (int sig) } #endif /* DBUS_UNIX */ +static void usage (void) _DBUS_GNUC_NORETURN; + static void usage (void) { @@ -158,6 +160,8 @@ usage (void) exit (1); } +static void version (void) _DBUS_GNUC_NORETURN; + static void version (void) { @@ -169,6 +173,8 @@ version (void) exit (0); } +static void introspect (void) _DBUS_GNUC_NORETURN; + static void introspect (void) { diff --git a/bus/test-launch-helper.c b/bus/test-launch-helper.c index 5d025f5f3..5872ab202 100644 --- a/bus/test-launch-helper.c +++ b/bus/test-launch-helper.c @@ -34,6 +34,8 @@ #error This file is only relevant for the embedded tests on Unix #endif +static void die (const char *failure) _DBUS_GNUC_NORETURN; + static void die (const char *failure) { diff --git a/bus/test-main.c b/bus/test-main.c index 9496dd2a7..4d3df87a4 100644 --- a/bus/test-main.c +++ b/bus/test-main.c @@ -39,6 +39,8 @@ # include #endif +static void die (const char *failure) _DBUS_GNUC_NORETURN; + static void die (const char *failure) { diff --git a/bus/test-system.c b/bus/test-system.c index 7d5c3dfbd..de1f003b6 100644 --- a/bus/test-system.c +++ b/bus/test-system.c @@ -33,6 +33,8 @@ #error This file is only relevant for the embedded tests on Unix #endif +static void die (const char *failure) _DBUS_GNUC_NORETURN; + static void die (const char *failure) { diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index 0be8800c3..655bfe92d 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -976,6 +976,8 @@ do_write (int fd, const void *buf, size_t count) goto again; } +static void write_err_and_exit (int fd, int msg) _DBUS_GNUC_NORETURN; + static void write_err_and_exit (int fd, int msg) { @@ -996,6 +998,8 @@ write_pid (int fd, pid_t pid) do_write (fd, &pid, sizeof (pid)); } +static void write_status_and_exit (int fd, int status) _DBUS_GNUC_NORETURN; + static void write_status_and_exit (int fd, int status) { @@ -1007,6 +1011,12 @@ write_status_and_exit (int fd, int status) exit (0); } +static void do_exec (int child_err_report_fd, + char * const *argv, + char * const *envp, + DBusSpawnChildSetupFunc child_setup, + void *user_data) _DBUS_GNUC_NORETURN; + static void do_exec (int child_err_report_fd, char * const *argv, @@ -1125,6 +1135,9 @@ babysit_signal_handler (int signo) goto again; } +static void babysit (pid_t grandchild_pid, + int parent_pipe) _DBUS_GNUC_NORETURN; + static void babysit (pid_t grandchild_pid, int parent_pipe) diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c index c0c6856a7..6c0d71f63 100644 --- a/dbus/dbus-test.c +++ b/dbus/dbus-test.c @@ -29,6 +29,8 @@ #include #ifdef DBUS_ENABLE_EMBEDDED_TESTS +static void die (const char *failure) _DBUS_GNUC_NORETURN; + static void die (const char *failure) { diff --git a/test/name-test/test-ids.c b/test/name-test/test-ids.c index f73a505fc..73b71f154 100644 --- a/test/name-test/test-ids.c +++ b/test/name-test/test-ids.c @@ -8,6 +8,8 @@ #include #endif +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/test/name-test/test-privserver-client.c b/test/name-test/test-privserver-client.c index 4268516a1..7a293f4ea 100644 --- a/test/name-test/test-privserver-client.c +++ b/test/name-test/test-privserver-client.c @@ -1,6 +1,9 @@ #include #include "../test-utils.h" +static void die (const char *message, + ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2); + static void die (const char *message, ...) { diff --git a/test/name-test/test-privserver.c b/test/name-test/test-privserver.c index 8bdd4f70b..535039d80 100644 --- a/test/name-test/test-privserver.c +++ b/test/name-test/test-privserver.c @@ -1,6 +1,9 @@ #include #include "../test-utils.h" +static void die (const char *message, + ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2); + static void die (const char *message, ...) { diff --git a/test/name-test/test-shutdown.c b/test/name-test/test-shutdown.c index 39612f185..e70bfd39e 100644 --- a/test/name-test/test-shutdown.c +++ b/test/name-test/test-shutdown.c @@ -4,6 +4,8 @@ static DBusLoop *loop; +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/test/test-names.c b/test/test-names.c index 273663508..95e428651 100644 --- a/test/test-names.c +++ b/test/test-names.c @@ -3,6 +3,8 @@ static DBusLoop *loop; +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/test/test-service.c b/test/test-service.c index 564875b05..bcfb7342c 100644 --- a/test/test-service.c +++ b/test/test-service.c @@ -19,6 +19,8 @@ quit (void) } } +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/test/test-shell-service.c b/test/test-shell-service.c index 32a883296..2eaccc1dc 100644 --- a/test/test-shell-service.c +++ b/test/test-shell-service.c @@ -22,6 +22,8 @@ quit (void) } } +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/test/test-utils-glib.c b/test/test-utils-glib.c index e08497714..ee286b983 100644 --- a/test/test-utils-glib.c +++ b/test/test-utils-glib.c @@ -429,6 +429,8 @@ time_out (gpointer data) } #ifdef G_OS_UNIX +static void wrap_abort (int signal) _DBUS_GNUC_NORETURN; + static void wrap_abort (int signal) { diff --git a/test/test-utils.c b/test/test-utils.c index cb6cf1fb7..3f4d19590 100644 --- a/test/test-utils.c +++ b/test/test-utils.c @@ -151,6 +151,8 @@ test_connection_setup (TestMainContext *ctx, return FALSE; } +static void die (const char *message) _DBUS_GNUC_NORETURN; + static void die (const char *message) { diff --git a/tools/dbus-echo.c b/tools/dbus-echo.c index 738b1cb3a..917d983c6 100644 --- a/tools/dbus-echo.c +++ b/tools/dbus-echo.c @@ -40,6 +40,8 @@ static int sleep_ms = -1; static dbus_bool_t noreply = FALSE; static dbus_bool_t noread = FALSE; +static void usage_echo (int exit_with) _DBUS_GNUC_NORETURN; + static void usage_echo (int exit_with) { @@ -60,6 +62,8 @@ usage_echo (int exit_with) exit (exit_with); } +static void usage_black_hole (int exit_with) _DBUS_GNUC_NORETURN; + static void usage_black_hole (int exit_with) { diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 4c872c3e5..65287af67 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -164,6 +164,8 @@ verbose (const char *format, #endif /* DBUS_ENABLE_VERBOSE_MODE */ } +static void usage (int ecode) _DBUS_GNUC_NORETURN; + static void usage (int ecode) { @@ -174,6 +176,8 @@ usage (int ecode) exit (ecode); } +static void version (void) _DBUS_GNUC_NORETURN; + static void version (void) { @@ -470,6 +474,8 @@ signal_handler (int sig) } } +static void kill_bus_when_session_ends (void) _DBUS_GNUC_NORETURN; + static void kill_bus_when_session_ends (void) { @@ -607,6 +613,7 @@ kill_bus_when_session_ends (void) } } } + /* not reached */ } _DBUS_GNUC_NORETURN static void @@ -736,6 +743,12 @@ do_close_stderr (void) } } +static void pass_info (const char *runprog, const char *bus_address, + pid_t bus_pid, long bus_wid, int c_shell_syntax, + int bourne_shell_syntax, int binary_syntax, + int argc, char **argv, + int remaining_args) _DBUS_GNUC_NORETURN; + static void pass_info (const char *runprog, const char *bus_address, pid_t bus_pid, long bus_wid, int c_shell_syntax, int bourne_shell_syntax, diff --git a/tools/dbus-launch.h b/tools/dbus-launch.h index 538278705..56596d26c 100644 --- a/tools/dbus-launch.h +++ b/tools/dbus-launch.h @@ -42,7 +42,7 @@ #define MAX_ADDR_LEN 512 /* defined in dbus-launch.c */ -void verbose (const char *format, ...); +void verbose (const char *format, ...) _DBUS_GNUC_PRINTF (1, 2); char *xstrdup (const char *str); void kill_bus_and_exit (int exitcode) _DBUS_GNUC_NORETURN; diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c index 483d42eec..aa28447fc 100644 --- a/tools/dbus-monitor.c +++ b/tools/dbus-monitor.c @@ -262,6 +262,8 @@ binary_filter_func (DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } +static void usage (char *name, int ecode) _DBUS_GNUC_NORETURN; + static void usage (char *name, int ecode) { diff --git a/tools/dbus-run-session.c b/tools/dbus-run-session.c index 105ab3b4f..135f5d21b 100644 --- a/tools/dbus-run-session.c +++ b/tools/dbus-run-session.c @@ -65,6 +65,8 @@ static const char me[] = "dbus-run-session"; +static void usage (int ecode) _DBUS_GNUC_NORETURN; + static void usage (int ecode) { @@ -81,6 +83,8 @@ usage (int ecode) exit (ecode); } +static void version (void) _DBUS_GNUC_NORETURN; + static void version (void) { @@ -95,6 +99,8 @@ version (void) exit (0); } +static void oom (void) _DBUS_GNUC_NORETURN; + static void oom (void) { @@ -191,6 +197,8 @@ exec_dbus_daemon (const char *dbus_daemon, me, dbus_daemon, strerror (errno)); } +static void exec_app (int prog_arg, char **argv) _DBUS_GNUC_NORETURN; + static void exec_app (int prog_arg, char **argv) { diff --git a/tools/dbus-send.c b/tools/dbus-send.c index e77e8098d..4982bd49a 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -49,6 +49,8 @@ static const char *appname; +static void usage (int ecode) _DBUS_GNUC_NORETURN; + static void usage (int ecode) { diff --git a/tools/dbus-spam.c b/tools/dbus-spam.c index 05d7efa42..9d2b04c3c 100644 --- a/tools/dbus-spam.c +++ b/tools/dbus-spam.c @@ -35,6 +35,8 @@ static dbus_bool_t ignore_errors = FALSE; +static void usage (int ecode) _DBUS_GNUC_NORETURN; + static void usage (int ecode) { diff --git a/tools/dbus-uuidgen.c b/tools/dbus-uuidgen.c index 744bbeb0e..337bdd0b3 100644 --- a/tools/dbus-uuidgen.c +++ b/tools/dbus-uuidgen.c @@ -27,6 +27,8 @@ #include #include +static void usage (const char *name, int ecode) _DBUS_GNUC_NORETURN; + static void usage (const char *name, int ecode) @@ -38,6 +40,8 @@ usage (const char *name, exit (ecode); } +static void version (void) _DBUS_GNUC_NORETURN; + static void version (void) {