summaryrefslogtreecommitdiff
path: root/test/stdlib
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-01-29 03:06:31 +0000
committerMike Frysinger <vapier@gentoo.org>2007-01-29 03:06:31 +0000
commitdf80b74f4b2d282ae9b07e951a798936bb706a48 (patch)
treed71b0b77860dfaa4412f3c0f55d73f17cf95574b /test/stdlib
parent92a56f367e6635bebf4e519a49943c15d2981d85 (diff)
mark some funcs as noreturn
Diffstat (limited to 'test/stdlib')
-rw-r--r--test/stdlib/testatexit.c58
-rw-r--r--test/stdlib/teston_exit.c57
2 files changed, 64 insertions, 51 deletions
diff --git a/test/stdlib/testatexit.c b/test/stdlib/testatexit.c
index 3d4856df3..01874fdde 100644
--- a/test/stdlib/testatexit.c
+++ b/test/stdlib/testatexit.c
@@ -13,31 +13,38 @@ typedef void (*vfuncp) (void);
/* All functions call exit(), in order to test that exit functions can call
* exit() without screwing everything up. :)
*/
-static void exitfunc0(void) { printf("Executing exitfunc0.\n"); exit(0);}
-static void exitfunc1(void) { printf("Executing exitfunc1.\n"); exit(0);}
-static void exitfunc2(void) { printf("Executing exitfunc2.\n"); exit(0);}
-static void exitfunc3(void) { printf("Executing exitfunc3.\n"); exit(0);}
-static void exitfunc4(void) { printf("Executing exitfunc4.\n"); exit(0);}
-static void exitfunc5(void) { printf("Executing exitfunc5.\n"); exit(0);}
-static void exitfunc6(void) { printf("Executing exitfunc6.\n"); exit(0);}
-static void exitfunc7(void) { printf("Executing exitfunc7.\n"); exit(0);}
-static void exitfunc8(void) { printf("Executing exitfunc8.\n"); exit(0);}
-static void exitfunc9(void) { printf("Executing exitfunc9.\n"); exit(0);}
-static void exitfunc10(void) { printf("Executing exitfunc10.\n"); exit(0);}
-static void exitfunc11(void) { printf("Executing exitfunc11.\n"); exit(0);}
-static void exitfunc12(void) { printf("Executing exitfunc12.\n"); exit(0);}
-static void exitfunc13(void) { printf("Executing exitfunc13.\n"); exit(0);}
-static void exitfunc14(void) { printf("Executing exitfunc14.\n"); exit(0);}
-static void exitfunc15(void) { printf("Executing exitfunc15.\n"); exit(0);}
-static void exitfunc16(void) { printf("Executing exitfunc16.\n"); exit(0);}
-static void exitfunc17(void) { printf("Executing exitfunc17.\n"); exit(0);}
-static void exitfunc18(void) { printf("Executing exitfunc18.\n"); exit(0);}
-static void exitfunc19(void) { printf("Executing exitfunc19.\n"); exit(0);}
-static void exitfunc20(void) { printf("Executing exitfunc20.\n"); exit(0);}
-static void exitfunc21(void) { printf("Executing exitfunc21.\n"); exit(0);}
-static void exitfunc22(void) { printf("Executing exitfunc22.\n"); exit(0);}
-static void exitfunc23(void) { printf("Executing exitfunc23.\n"); exit(0);}
-static void exitfunc24(void) { printf("Executing exitfunc24.\n"); exit(0);}
+#define make_exitfunc(num) \
+__attribute__ ((__noreturn__)) static \
+void exitfunc##num(void) \
+{ \
+ printf("Executing exitfunc"#num".\n"); \
+ exit(0); \
+}
+make_exitfunc(0)
+make_exitfunc(1)
+make_exitfunc(2)
+make_exitfunc(3)
+make_exitfunc(4)
+make_exitfunc(5)
+make_exitfunc(6)
+make_exitfunc(7)
+make_exitfunc(8)
+make_exitfunc(9)
+make_exitfunc(10)
+make_exitfunc(11)
+make_exitfunc(12)
+make_exitfunc(13)
+make_exitfunc(14)
+make_exitfunc(15)
+make_exitfunc(16)
+make_exitfunc(17)
+make_exitfunc(18)
+make_exitfunc(19)
+make_exitfunc(20)
+make_exitfunc(21)
+make_exitfunc(22)
+make_exitfunc(23)
+make_exitfunc(24)
static vfuncp func_table[] =
{
@@ -72,4 +79,3 @@ main ( void )
return 0;
}
-
diff --git a/test/stdlib/teston_exit.c b/test/stdlib/teston_exit.c
index c5789b083..f7e8fd004 100644
--- a/test/stdlib/teston_exit.c
+++ b/test/stdlib/teston_exit.c
@@ -14,31 +14,38 @@ typedef void (*efuncp) (int, void *);
* exit() without screwing everything up. The value passed in through arg gets
* used as the next exit status.
*/
-static void exitfunc0(int status, void *arg) { printf("Executing exitfunc0 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc1(int status, void *arg) { printf("Executing exitfunc1 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc2(int status, void *arg) { printf("Executing exitfunc2 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc3(int status, void *arg) { printf("Executing exitfunc3 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc4(int status, void *arg) { printf("Executing exitfunc4 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc5(int status, void *arg) { printf("Executing exitfunc5 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc6(int status, void *arg) { printf("Executing exitfunc6 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc7(int status, void *arg) { printf("Executing exitfunc7 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc8(int status, void *arg) { printf("Executing exitfunc8 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc9(int status, void *arg) { printf("Executing exitfunc9 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc10(int status, void *arg) { printf("Executing exitfunc10 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc11(int status, void *arg) { printf("Executing exitfunc11 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc12(int status, void *arg) { printf("Executing exitfunc12 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc13(int status, void *arg) { printf("Executing exitfunc13 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc14(int status, void *arg) { printf("Executing exitfunc14 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc15(int status, void *arg) { printf("Executing exitfunc15 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc16(int status, void *arg) { printf("Executing exitfunc16 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc17(int status, void *arg) { printf("Executing exitfunc17 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc18(int status, void *arg) { printf("Executing exitfunc18 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc19(int status, void *arg) { printf("Executing exitfunc19 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc20(int status, void *arg) { printf("Executing exitfunc20 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc21(int status, void *arg) { printf("Executing exitfunc21 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc22(int status, void *arg) { printf("Executing exitfunc22 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc23(int status, void *arg) { printf("Executing exitfunc23 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
-static void exitfunc24(int status, void *arg) { printf("Executing exitfunc24 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);}
+#define make_exitfunc(num) \
+__attribute__ ((__noreturn__)) static \
+void exitfunc##num(int status, void *arg) \
+{ \
+ printf("Executing exitfunc"#num" (status=%d, arg=%lu)\n", status, (unsigned long)arg); \
+ exit((unsigned long)arg); \
+}
+make_exitfunc(0)
+make_exitfunc(1)
+make_exitfunc(2)
+make_exitfunc(3)
+make_exitfunc(4)
+make_exitfunc(5)
+make_exitfunc(6)
+make_exitfunc(7)
+make_exitfunc(8)
+make_exitfunc(9)
+make_exitfunc(10)
+make_exitfunc(11)
+make_exitfunc(12)
+make_exitfunc(13)
+make_exitfunc(14)
+make_exitfunc(15)
+make_exitfunc(16)
+make_exitfunc(17)
+make_exitfunc(18)
+make_exitfunc(19)
+make_exitfunc(20)
+make_exitfunc(21)
+make_exitfunc(22)
+make_exitfunc(23)
+make_exitfunc(24)
static efuncp func_table[] =
{