From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11202 invoked by alias); 12 Oct 2016 14:09:49 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 11172 invoked by uid 89); 12 Oct 2016 14:09:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=claims X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Subject: Re: Move OVERRIDE/FINAL from gcc/coretypes.h to include/ansidecl.h To: Bernd Schmidt , Trevor Saunders References: <1462552846-17096-1-git-send-email-dmalcolm@redhat.com> <8ce94f18-421f-9466-85cf-e17d9caee151@redhat.com> <20160506183345.GK3628@ball> <5b2de202-c6bd-f8fc-3407-45a40ddfe62c@redhat.com> Cc: David Malcolm , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org From: Pedro Alves Message-ID: <014f88ec-909b-db46-1213-e9dbb8f14ee4@redhat.com> Date: Fri, 01 Jan 2016 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 12 Oct 2016 14:09:46 +0000 (UTC) X-SW-Source: 2016-q4/txt/msg00002.txt.bz2 On 10/12/2016 03:01 PM, Bernd Schmidt wrote: > On 10/10/2016 09:32 PM, Pedro Alves wrote: >> From: Pedro Alves >> Date: 2016-10-10 19:25:47 +0100 >> >> Move OVERRIDE/FINAL from gcc/coretypes.h to include/ansidecl.h >> >> So that GDB and other projects that share the top level can use them. > > Seems reasonable. OK unless someone objects by the end of the week. Thanks. Here's a follow up patch that I was just testing. Need this if building with "g++ -std=gnu++11", with gcc < 4.7. From: Pedro Alves Date: 2016-10-12 01:49:53 +0100 FINAL/OVERRIDE: Define to empty on g++ < 4.7 final/override were only implemented in 4.7. include/ChangeLog 2016-10-12 Pedro Alves * ansidecl.h [__cplusplus >= 201103 && GCC_VERSION > 4007] (FINAL, OVERRIDE): Define as empty. [__cplusplus < 201103 && GCC_VERSION > 4007] (FINAL): Define as __final. [__cplusplus < 201103 && GCC_VERSION > 4007] (OVERRIDE): Define as empty. --- include/ansidecl.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/ansidecl.h b/include/ansidecl.h index ee93421..08aeb1e 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -329,13 +329,23 @@ So instead we use the macro below and test it against specific values. */ this by default (actually GNU++14). */ #if __cplusplus >= 201103 -/* C++11 claims to be available: use it: */ -#define OVERRIDE override -#define FINAL final +/* C++11 claims to be available: use it. final/override were only + implemented in 4.7, though. */ +# if GCC_VERSION < 4007 +# define OVERRIDE +# define FINAL +# else +# define OVERRIDE override +# define FINAL final +# endif +#elif GCC_VERSION >= 4007 +/* G++ 4.7 supports __final in C++98. */ +# define OVERRIDE +# define FINAL __final #else /* No C++11 support; leave the macros empty: */ -#define OVERRIDE -#define FINAL +# define OVERRIDE +# define FINAL #endif #ifdef __cplusplus