summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-03-18 22:02:38 +0100
committerBruno Haible <bruno@clisp.org>2019-03-18 22:02:38 +0100
commit661f63a41ac96060878e9fe94e547ded44e3f371 (patch)
treed2d9f64cbc915e798f4e10c6b47a627f1a5c18ea
parent03eccb2d010e0755fd55458e2f012fcfb0735c2d (diff)
downloadgnulib-661f63a41ac96060878e9fe94e547ded44e3f371.tar.gz
_Noreturn: clang and MSVC do support [[noreturn]] in C++11 mode.
* lib/_Noreturn.h: Use [[noreturn]] if __GNUC__ and __GNUC_MINOR__ indicate clang, or if _MSC_VER indicates MSVC++ 14.0 or newer.
-rw-r--r--ChangeLog6
-rw-r--r--lib/_Noreturn.h5
-rw-r--r--m4/gnulib-common.m47
3 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 81e3710486..02bed463ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-18 Bruno Haible <bruno@clisp.org>
+
+ _Noreturn: clang and MSVC do support [[noreturn]] in C++11 mode.
+ * lib/_Noreturn.h: Use [[noreturn]] if __GNUC__ and __GNUC_MINOR__
+ indicate clang, or if _MSC_VER indicates MSVC++ 14.0 or newer.
+
2019-03-17 Akim Demaille <akim@lrde.epita.fr>
_Noreturn: GCC 4.7 does not support [[noreturn]] in C++11 mode
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index 19597e0bf3..1629cef39b 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -1,6 +1,7 @@
#ifndef _Noreturn
-# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \
- && (!defined __GNUC__ || 4 < __GNUC__ + (8 <= __GNUC_MINOR__)))
+# if (defined __cplusplus \
+ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+ || (defined _MSC_VER && 1900 <= _MSC_VER)))
# define _Noreturn [[noreturn]]
# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__))
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 688a1e59e8..20666a552a 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 42
+# gnulib-common.m4 serial 43
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,
@@ -17,8 +17,9 @@ AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([_Noreturn],
[/* The _Noreturn keyword of C11. */
#ifndef _Noreturn
-# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \
- && (!defined __GNUC__ || 4 < __GNUC__ + (8 <= __GNUC_MINOR__)))
+# if (defined __cplusplus \
+ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+ || (defined _MSC_VER && 1900 <= _MSC_VER)))
# define _Noreturn [[noreturn]]
# elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| 4 < __GNUC__ + (7 <= __GNUC_MINOR__))