From 03eccb2d010e0755fd55458e2f012fcfb0735c2d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 17 Mar 2019 19:27:20 +0100 Subject: [PATCH] _Noreturn: GCC 4.7 does not support [[noreturn]] in C++11 mode * lib/_Noreturn.h, m4/gnulib-common.m4: Don't use [[noreturn]] before GCC 4.8. --- ChangeLog | 6 ++++++ lib/_Noreturn.h | 3 ++- m4/gnulib-common.m4 | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28787600fa..81e3710486 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-03-17 Akim Demaille + + _Noreturn: GCC 4.7 does not support [[noreturn]] in C++11 mode + * lib/_Noreturn.h, m4/gnulib-common.m4: Don't use [[noreturn]] before + GCC 4.8. + 2019-03-17 Paul Eggert fts: minor simplification diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h index 94fdfaf022..19597e0bf3 100644 --- a/lib/_Noreturn.h +++ b/lib/_Noreturn.h @@ -1,5 +1,6 @@ #ifndef _Noreturn -# if 201103 <= (defined __cplusplus ? __cplusplus : 0) +# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \ + && (!defined __GNUC__ || 4 < __GNUC__ + (8 <= __GNUC_MINOR__))) # 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 7c0e3e8fa4..688a1e59e8 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 41 +# gnulib-common.m4 serial 42 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,7 +17,8 @@ AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([_Noreturn], [/* The _Noreturn keyword of C11. */ #ifndef _Noreturn -# if 201103 <= (defined __cplusplus ? __cplusplus : 0) +# if (201103 <= (defined __cplusplus ? __cplusplus : 0) \ + && (!defined __GNUC__ || 4 < __GNUC__ + (8 <= __GNUC_MINOR__))) # define _Noreturn [[noreturn]] # elif (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)) -- 2.39.5