From: Lucas De Marchi Date: Wed, 8 Feb 2012 22:32:31 +0000 (-0200) Subject: Mark functions with attribute noreturn X-Git-Tag: v6~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32d29b352338e5f01641eed08ab94d79d943e707;p=thirdparty%2Fkmod.git Mark functions with attribute noreturn 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. --- diff --git a/testsuite/test-init.c b/testsuite/test-init.c index c807a16b..f09c4d21 100644 --- a/testsuite/test-init.c +++ b/testsuite/test-init.c @@ -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; diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c index 007cc0a3..0ff69989 100644 --- a/testsuite/test-modinfo.c +++ b/testsuite/test-modinfo.c @@ -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[] = { diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index cbcd157b..38d6c4c4 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -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[] = { diff --git a/testsuite/test-testsuite.c b/testsuite/test-testsuite.c index 1c128305..043e09d5 100644 --- a/testsuite/test-testsuite.c +++ b/testsuite/test-testsuite.c @@ -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); diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index 01512064..60936836 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -138,3 +138,5 @@ int test_run(const struct test *t); } \ #endif + +#define __noreturn __attribute__((noreturn))