Mark functions with attribute noreturn
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 8 Feb 2012 22:32:31 +0000 (20:32 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 8 Feb 2012 22:32:31 +0000 (20:32 -0200)
Functions that always call exit() should be marked with attribute
noreturn. With glibc this is not necessary, but it fails to compile with
uClibc otherwise.

testsuite/test-init.c
testsuite/test-modinfo.c
testsuite/test-modprobe.c
testsuite/test-testsuite.c
testsuite/testsuite.h

index c807a16..f09c4d2 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "testsuite.h"
 
-static int test_initlib(const struct test *t)
+static __noreturn int test_initlib(const struct test *t)
 {
        struct kmod_ctx *ctx;
        const char *null_config = NULL;
@@ -41,7 +41,7 @@ static int test_initlib(const struct test *t)
 static DEFINE_TEST(test_initlib,
                .description = "test if libkmod's init function work");
 
-static int test_insert(const struct test *t)
+static __noreturn int test_insert(const struct test *t)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod;
@@ -75,7 +75,7 @@ static DEFINE_TEST(test_insert,
        },
        .need_spawn = true);
 
-static int test_remove(const struct test *t)
+static __noreturn int test_remove(const struct test *t)
 {
        struct kmod_ctx *ctx;
        struct kmod_module *mod;
index 007cc0a..0ff6998 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "testsuite.h"
 
-static int modinfo_jonsmodules(const struct test *t)
+static __noreturn int modinfo_jonsmodules(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modinfo";
        const char *const args[] = {
index cbcd157..38d6c4c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "testsuite.h"
 
-static int modprobe_show_depends(const struct test *t)
+static __noreturn int modprobe_show_depends(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
        const char *const args[] = {
@@ -47,7 +47,7 @@ static DEFINE_TEST(modprobe_show_depends,
                .stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct.txt",
        });
 
-static int modprobe_show_depends2(const struct test *t)
+static __noreturn int modprobe_show_depends2(const struct test *t)
 {
        const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
        const char *const args[] = {
index 1c12830..043e09d 100644 (file)
@@ -31,7 +31,7 @@
 
 
 #define TEST_UNAME "4.0.20-kmod"
-static int testsuite_uname(const struct test *t)
+static __noreturn int testsuite_uname(const struct test *t)
 {
        struct utsname u;
        int err = uname(&u);
index 0151206..6093683 100644 (file)
@@ -138,3 +138,5 @@ int test_run(const struct test *t);
        }                                                       \
 
 #endif
+
+#define __noreturn __attribute__((noreturn))