From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71922 invoked by alias); 30 Jul 2018 08:50:09 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 70970 invoked by uid 10080); 30 Jul 2018 08:49:11 -0000 Date: Mon, 30 Jul 2018 08:50:00 -0000 Message-ID: <20180730084911.70968.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Make _Static_assert() work with GCC in older C++ standards. X-Act-Checkin: newlib-cygwin X-Git-Author: ed@FreeBSD.org X-Git-Refname: refs/heads/master X-Git-Oldrev: 0e5f252bc79f137a7747643dd1bc2693d98c0668 X-Git-Newrev: 84e294dc694257d8f3e9b00a4a0651afbf76132a X-SW-Source: 2018-q3/txt/msg00025.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=84e294dc694257d8f3e9b00a4a0651afbf76132a commit 84e294dc694257d8f3e9b00a4a0651afbf76132a Author: ed@FreeBSD.org Date: Mon Aug 28 09:35:17 2017 +0000 Make _Static_assert() work with GCC in older C++ standards. GCC only activates C11 keywords in C mode, not C++ mode. This means that when targeting an older C++ standard, we cannot fall back to using _Static_assert(). In this case, do define _Static_assert() as a macro that uses a typedef'ed array. Discussed in: r322875 commit thread Reported by: Mark MIllard MFC after: 1 month Diff: --- newlib/libc/include/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index b3f8d19..49be9e0 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -314,7 +314,7 @@ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) -#elif __GNUC_PREREQ__(4,6) +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) #define _Static_assert(x, y) __Static_assert(x, __COUNTER__)