Add missing function attributes suggested by clang (but not by gcc)
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 7 Oct 2016 18:45:48 +0000 (19:45 +0100)
committerSimon McVittie <smcv@debian.org>
Thu, 13 Oct 2016 21:44:13 +0000 (22:44 +0100)
clang is a little more enthusiastic about suggesting these.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
23 files changed:
bus/main.c
bus/test-launch-helper.c
bus/test-main.c
bus/test-system.c
dbus/dbus-spawn.c
dbus/dbus-test.c
test/name-test/test-ids.c
test/name-test/test-privserver-client.c
test/name-test/test-privserver.c
test/name-test/test-shutdown.c
test/test-names.c
test/test-service.c
test/test-shell-service.c
test/test-utils-glib.c
test/test-utils.c
tools/dbus-echo.c
tools/dbus-launch.c
tools/dbus-launch.h
tools/dbus-monitor.c
tools/dbus-run-session.c
tools/dbus-send.c
tools/dbus-spam.c
tools/dbus-uuidgen.c

index a325cea..5e26820 100644 (file)
@@ -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)
 {
index 5d025f5..5872ab2 100644 (file)
@@ -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)
 {
index 9496dd2..4d3df87 100644 (file)
@@ -39,6 +39,8 @@
 # include <dbus/dbus-sysdeps-unix.h>
 #endif
 
+static void die (const char *failure) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *failure)
 {
index 7d5c3df..de1f003 100644 (file)
@@ -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)
 {
index 0be8800..655bfe9 100644 (file)
@@ -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)
index c0c6856..6c0d71f 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdlib.h>
 
 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
+static void die (const char *failure) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *failure)
 {
index f73a505..73b71f1 100644 (file)
@@ -8,6 +8,8 @@
 #include <unistd.h>
 #endif
 
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *message)
 {
index 4268516..7a293f4 100644 (file)
@@ -1,6 +1,9 @@
 #include <config.h>
 #include "../test-utils.h"
 
+static void die (const char *message,
+                 ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
+
 static void
 die (const char *message, ...)
 {
index 8bdd4f7..535039d 100644 (file)
@@ -1,6 +1,9 @@
 #include <config.h>
 #include "../test-utils.h"
 
+static void die (const char *message,
+                 ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
+
 static void
 die (const char *message, ...)
 {
index 39612f1..e70bfd3 100644 (file)
@@ -4,6 +4,8 @@
 
 static DBusLoop *loop;
 
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *message)
 {
index 2736635..95e4286 100644 (file)
@@ -3,6 +3,8 @@
 
 static DBusLoop *loop;
 
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *message)
 {
index 564875b..bcfb734 100644 (file)
@@ -19,6 +19,8 @@ quit (void)
     }
 }
 
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *message)
 {
index 32a8832..2eaccc1 100644 (file)
@@ -22,6 +22,8 @@ quit (void)
     }
 }
 
+static void die (const char *message) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *message)
 {
index e084977..ee286b9 100644 (file)
@@ -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)
 {
index cb6cf1f..3f4d195 100644 (file)
@@ -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)
 {
index 738b1cb..917d983 100644 (file)
@@ -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)
 {
index 4c872c3..65287af 100644 (file)
@@ -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,
index 5382787..56596d2 100644 (file)
@@ -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;
 
index 483d42e..aa28447 100644 (file)
@@ -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)
 {
index 105ab3b..135f5d2 100644 (file)
@@ -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)
 {
index e77e809..4982bd4 100644 (file)
@@ -49,6 +49,8 @@
 
 static const char *appname;
 
+static void usage (int ecode) _DBUS_GNUC_NORETURN;
+
 static void
 usage (int ecode)
 {
index 05d7efa..9d2b04c 100644 (file)
@@ -35,6 +35,8 @@
 
 static dbus_bool_t ignore_errors = FALSE;
 
+static void usage (int ecode) _DBUS_GNUC_NORETURN;
+
 static void
 usage (int ecode)
 {
index 744bbeb..337bdd0 100644 (file)
@@ -27,6 +27,8 @@
 #include <dbus/dbus-uuidgen.h>
 #include <dbus/dbus.h>
 
+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)
 {