]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-common.m4: port _Noreturn to C++
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 2 Nov 2018 21:09:35 +0000 (14:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 2 Nov 2018 21:10:02 +0000 (14:10 -0700)
Problem reported by Akim Demaille in:
https://lists.gnu.org/r/bug-bison/2018-10/msg00067.html
* m4/gnulib-common.m4 (gl_COMMON_BODY): If C++, use [[noreturn]].
Merge adjustments from _Noreturn.h and from glibc into the non-C++
version.
* lib/_Noreturn.h: Match gnulib-common.

ChangeLog
lib/_Noreturn.h
m4/gnulib-common.m4

index 94f8e919fc2499d5d82566ee4b05a31f7aa58625..bbf379b8c7da6c915a31adf2b2883a5d69e672c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-11-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       gnulib-common.m4: port _Noreturn to C++
+       Problem reported by Akim Demaille in:
+       https://lists.gnu.org/r/bug-bison/2018-10/msg00067.html
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): If C++, use [[noreturn]].
+       Merge adjustments from _Noreturn.h and from glibc into the non-C++
+       version.
+       * lib/_Noreturn.h: Match gnulib-common.
+
 2018-10-30  Bruno Haible  <bruno@clisp.org>
 
        gnu-make: Fix for NetBSD 8 'make'.
index c44ad89b7c09315601bfb48467992f9fff797093..94fdfaf0220f98b42c569d0f9040ee6df3306ce4 100644 (file)
@@ -1,8 +1,12 @@
-#if !defined _Noreturn && __STDC_VERSION__ < 201112
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
-      || 0x5110 <= __SUNPRO_C)
+#ifndef _Noreturn
+# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
+#  define _Noreturn [[noreturn]]
+# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+        || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
+   /* _Noreturn works as-is.  */
+# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
index 1b8cdd567cf012081b68379d96fbc6408ccf88a6..2b253dabf520bd636e5f2333476331db1a87cd44 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 40
+# gnulib-common.m4 serial 41
 dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,12 +16,15 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#if ! (defined _Noreturn \
-       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
-      || 0x5110 <= __SUNPRO_C)
+#ifndef _Noreturn
+# if 201103 <= (defined __cplusplus ? __cplusplus : 0)
+#  define _Noreturn [[noreturn]]
+# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
+        || 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
+   /* _Noreturn works as-is.  */
+# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif defined _MSC_VER && 1200 <= _MSC_VER
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn