From patchwork Wed Oct 12 14:09:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 681335 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3svG2t44Mzz9s9Y for ; Thu, 13 Oct 2016 01:09:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XTgfCuA9; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=KvhJPagnWAUgLSxLDj/dDm6oQgEZSEYbRh7VvTSligZvg+eSGOIWh 5jmFEm5dnNtTmFG+VjjGaQRIQgUi0zgXPJS76ROkSCJa+SggK/3cXto5CBiNn/b3 33X7JxGKj2U22b/FsplTXAaJSkPWfH5xKJIdUmJ7AwFLHr4Nq7kjKE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=default; bh=2iVQaePpd7wjVOqFGCZwIizaP+0=; b=XTgfCuA95HDLK0U5iEyqc2C/KTqR 9KUg5uyHQiC0Utdq6E3zShypa24/26ocCKmahz4FakSryG+3KiUBB3XsHqRyur58 e7mtE4QaoVlmVkqet90CL78f8g1376Y8NlYh8YNs5X9fmuCftZ2NORWtQrBQ+PzA qEoRV20iwhvgGvQ= Received: (qmail 11201 invoked by alias); 12 Oct 2016 14:09:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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-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-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Oct 2016 14:09:47 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0981B335F6A; Wed, 12 Oct 2016 14:09:46 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9CE9gKd000470; Wed, 12 Oct 2016 10:09:43 -0400 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: Wed, 12 Oct 2016 15:09:42 +0100 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: 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