]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid hassles caused by [[noreturn]] in C++.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Dec 2019 08:19:17 +0000 (09:19 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Dec 2019 08:30:46 +0000 (09:30 +0100)
Reported by Christian Biesinger <cbiesinger@google.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00010.html>.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Disable the use of [[noreturn]].
* lib/_Noreturn.h: Likewise.

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

index b441ffd1c40ef82f0367070b9e8726bf18f7af71..2d26706b9226f36c914033ce3eb88e8934d722f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-03  Bruno Haible  <bruno@clisp.org>
+
+       Avoid hassles caused by [[noreturn]] in C++.
+       Reported by Christian Biesinger <cbiesinger@google.com> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00010.html>.
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): Disable the use of [[noreturn]].
+       * lib/_Noreturn.h: Likewise.
+
 2019-12-02  Bruno Haible  <bruno@clisp.org>
 
        Fix mistakes in --enable-threads=isoc fixes from 2019-12-01.
index 06320b8cf2e320593c2980b316ebbd4043a669e3..d99e377a02bc6ba4362719b5a260c39d28c49c9a 100644 (file)
 #ifndef _Noreturn
 # if (defined __cplusplus \
       && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
-          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
 #  define _Noreturn [[noreturn]]
 # elif ((!defined __cplusplus || defined __clang__)                     \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
index 479c9de9eab888e62ec389b03d37951f05f87f26..d8f0d3fb5662bb5c1660b2b52de067add90a29e1 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 45
+# gnulib-common.m4 serial 46
 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,7 +19,14 @@ AC_DEFUN([gl_COMMON_BODY], [
 #ifndef _Noreturn
 # if (defined __cplusplus \
       && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
-          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+          || (defined _MSC_VER && 1900 <= _MSC_VER)) \
+      && 0)
+    /* [[noreturn]] is not practically usable, because with it the syntax
+         extern _Noreturn void func (...);
+       would not be valid; such a declaration would only be valid with 'extern'
+       and '_Noreturn' swapped, or without the 'extern' keyword.  However, some
+       AIX system header files and several gnulib header files use precisely
+       this syntax with 'extern'.  */
 #  define _Noreturn [[noreturn]]
 # elif ((!defined __cplusplus || defined __clang__) \
         && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \