Mercurial > hg > octave-nkf > gnulib-hg
changeset 15413:90b622f91c85
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 12 Jul 2011 01:16:45 -0700 |
parents | 7f0f3e1ac6fd |
children | 8b9638e15677 |
files | ChangeLog tests/test-_Exit.c |
diffstat | 2 files changed, 26 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2011-07-12 Paul Eggert <eggert@cs.ucla.edu> + 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 <http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00209.html>.
--- a/tests/test-_Exit.c +++ b/tests/test-_Exit.c @@ -20,8 +20,26 @@ #include <stdlib.h> -int -main () +/* 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) { - _Exit (81); + MTA (n - 1); } + +static void +MTA (int n) +{ + if (n < 0) + _Exit (81); + Charlie (n - 1); +} + +int +main (int argc, char **argv) +{ + MTA (argc + !!argv); +}