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 21:07:49 -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 14:51, Bruno Haible wrote:
> I would not risk to rely on __STDC_VERSION__.

In the long run __STDC_VERSION__ may be simpler, but for now I agree
it's safer to avoid it.  Also, we can add something for
_MSC_VER.  The following patch should do the trick.
It's a pain that there are two copies of this #if-chain,
but I don't know an easy way to fix this.

_Noreturn: Ignore __STDC_VERSION__; observe _MSC_VER.
* build-aux/_Noreturn.h (_Noreturn): Ignore __STDC_VERSION__.
Reparenthesize to avoid GCC warning.
Support Microsoft's syntax.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Likewise.
diff --git a/build-aux/_Noreturn.h b/build-aux/_Noreturn.h
index e309292..1a7b4da 100644
--- a/build-aux/_Noreturn.h
+++ b/build-aux/_Noreturn.h
@@ -1,7 +1,9 @@
-#if ! defined _Noreturn && __STDC_VERSION__ < 201000
-# if (3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ \
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
 # endif
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index f3f0a7d..6b5923a 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 27
+# gnulib-common.m4 serial 28
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,10 +14,12 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of draft C1X.  */
-#if ! defined _Noreturn && __STDC_VERSION__ < 201000L
-# if (3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ \
+#ifndef _Noreturn
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
+# elif 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
 # endif



reply via email to

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