From: Paul Eggert Date: Tue, 12 Jul 2011 08:16:45 +0000 (-0700) Subject: modules/_Exit-tests: test _Noreturn too X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98f5f49c52c849fc0e408ad3aad2ad692e37615c;p=pspp modules/_Exit-tests: test _Noreturn too * tests/test-_Exit.c (MTA, Charlie): New functions, taken from the old tests/test-stdnoreturn.c. This tests the _Noreturn keyword a bit. (main): Use them. --- diff --git a/ChangeLog b/ChangeLog index 551943d3f5..84e49fda66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-07-12 Paul Eggert + modules/_Exit-tests: test _Noreturn too + * tests/test-_Exit.c (MTA, Charlie): New functions, taken from the + old tests/test-stdnoreturn.c. This tests the _Noreturn keyword a bit. + (main): Use them. + stdnoreturn, stdnoreturn-tests: remove modules They're not needed here and a bit premature for use elsewhere. See . diff --git a/tests/test-_Exit.c b/tests/test-_Exit.c index 7502153273..bc00730460 100644 --- a/tests/test-_Exit.c +++ b/tests/test-_Exit.c @@ -20,8 +20,26 @@ #include +/* But did he ever return? No he never returned, + And his fate is still unlearned ... */ +static _Noreturn void MTA (int); + +static _Noreturn void +Charlie (int n) +{ + MTA (n - 1); +} + +static void +MTA (int n) +{ + if (n < 0) + _Exit (81); + Charlie (n - 1); +} + int -main () +main (int argc, char **argv) { - _Exit (81); + MTA (argc + !!argv); }