Re: AC_C_NORETURN macro?

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

 



On 04/29/2012 08:34 AM, Vincent Lefevre wrote:
I don't like the fact that you assume by default that compilers
are non-conforming

Nor do I.  How about the following improvement to the heuristic?
It is just a heuristic so we can't do a perfect job, but the
following should be better than what we have now:

---
 ChangeLog                     |   10 ++++++++++
 build-aux/snippet/_Noreturn.h |    2 +-
 m4/gnulib-common.m4           |    2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b81a470..83ad2bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-04-29  Paul Eggert  <eggert@xxxxxxxxxxx>
+
+	_Noreturn: future-proof non-GNU and non-MSVC compilers
+	* build-aux/snippet/_Noreturn.h (_Noreturn):
+	* m4/gnulib-common.m4 (gl_COMMON_BODY):
+	Do not define _Noreturn if __STDC_VERSION__ indicates this is
+	C11 or later.  This is more likely to work with random future C
+	compilers that are neither GNUish nor MSVCish.  See Vincent Lefevre in
+	<http://lists.gnu.org/archive/html/bug-gnulib/2012-04/msg00195.html>.
+
 2012-04-26  Stefano Lattarini  <stefano.lattarini@xxxxxxxxx>
bootstrap: support Automake-NG in $buildreq
diff --git a/build-aux/snippet/_Noreturn.h b/build-aux/snippet/_Noreturn.h
index 1a7b4da..c44ad89 100644
--- a/build-aux/snippet/_Noreturn.h
+++ b/build-aux/snippet/_Noreturn.h
@@ -1,4 +1,4 @@
-#ifndef _Noreturn
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index ae4d254..ab3c43d 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -14,7 +14,7 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#ifndef _Noreturn
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
--
1.7.6.5


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux