bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/19] * m4/gnulib-common.m4 (gl_COMMON_BODY): Add _Noreturn.


From: Paul Eggert
Subject: Re: [PATCH 01/19] * m4/gnulib-common.m4 (gl_COMMON_BODY): Add _Noreturn.
Date: Mon, 11 Jul 2011 22:04:14 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10

On 07/11/11 21:58, Paul Eggert wrote:
> Since the stdnoreturn
> module no longer seems useful, the following patch removes it as well.

However, it does seem useful to retain the test for _Noreturn
*somewhere*.  _Exit-tests is as good a place as any:

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/tests/test-_Exit.c b/tests/test-_Exit.c
index 7502153..bc00730 100644
--- a/tests/test-_Exit.c
+++ b/tests/test-_Exit.c
@@ -20,8 +20,26 @@

 #include <stdlib.h>

+/* 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);
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]