summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-12-03 09:19:17 +0100
committerBruno Haible <bruno@clisp.org>2019-12-03 09:30:46 +0100
commit56a2150cb8f33d7868f42098702173a0ccb38760 (patch)
treeb6ff94d017be31c5c5df0912c9e5e1d827908fbb
parentaf16e1b401433476796c3bab5245c0a679c4dd26 (diff)
downloadgnulib-56a2150cb8f33d7868f42098702173a0ccb38760.tar.gz
gnulib-56a2150cb8f33d7868f42098702173a0ccb38760.tar.bz2
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.
-rw-r--r--ChangeLog8
-rw-r--r--lib/_Noreturn.h9
-rw-r--r--m4/gnulib-common.m411
3 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b441ffd1c4..2d26706b92 100644
--- 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.
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index 06320b8cf2..d99e377a02 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -17,7 +17,14 @@
#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) \
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 479c9de9ea..d8f0d3fb56 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -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) \

Return to:

Send suggestions and report system problems to the System administrator.