From patchwork Mon May 23 23:42:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 54325 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 731AE3857428 for ; Mon, 23 May 2022 23:44:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 731AE3857428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653349451; bh=NoTd0KdRpesoP5J4eseGO1AtG34SJZNknv1lt839Bn0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RtDYYQsXs1+eHM/s5eID6/sRkw37gcrXzlZG9IqbeXA2egsxOvIy/wW7/4TyqeXw1 5IQqSC6IBh/2PBkagr7vrGsVp32hgc2DRdEPLwSFb56E3ArbT/Ecfqi097dp78WQkw U23yfYl9NlN129S5krRfLkMDiS/baVtznpbq1jcI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 9EB683857806 for ; Mon, 23 May 2022 23:42:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9EB683857806 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-27-JcJA-RPHMzmRFRDMelQuuw-1; Mon, 23 May 2022 19:42:37 -0400 X-MC-Unique: JcJA-RPHMzmRFRDMelQuuw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81287810BCF; Mon, 23 May 2022 23:42:37 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.2.17.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2864A1410DD5; Mon, 23 May 2022 23:42:37 +0000 (UTC) To: Richard Biener , gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h Date: Mon, 23 May 2022 19:42:29 -0400 Message-Id: <20220523234229.3802109-1-dmalcolm@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" libiberty's ansidecl.h provides macros FINAL and OVERRIDE to allow virtual functions to be labelled with the C++11 "final" and "override" specifiers, but with empty implementations on pre-C++11 C++ compilers. We've used the macros in many places in GCC, but as of as of GCC 11 onwards GCC has required a C++11 compiler, such as GCC 4.8 or later. On the assumption that any such compiler correctly implements "final" and "override", I've recently simplified GCC's codebase by replacing all uses of the FINAL and OVERRIDE macros in GCC's source tree with the lower-case specifiers (via commits r13-690-gff171cb13df671 and r13-716-g8473ef7be60443). Here's a patch to eliminate the macros from ansidecl.h which I was hoping to apply to GCC to complete this transition - but ansidecl.h is shared with other projects. I've successfully bootstrapped & regrtested GCC trunk on x86_64-pc-linux-gnu with this patch. Of the various other GNU projects using libiberty implemented in C++, does anyone support being built with a pre-C++11 compiler, or does everyone assume C++11 or later? Is anyone else still using these macros? Any objections, or is there a reason to keep these macros that I'm not aware of? (and did I send this to all the pertinent lists?) Thanks Dave include/ChangeLog: * ansidecl.h: Drop macros OVERRIDE and FINAL. Signed-off-by: David Malcolm --- include/ansidecl.h | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/include/ansidecl.h b/include/ansidecl.h index 46fe3ffabd9..056a03ebb6e 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -321,47 +321,6 @@ So instead we use the macro below and test it against specific values. */ #define CONSTEXPR #endif -/* C++11 adds the ability to add "override" after an implementation of a - virtual function in a subclass, to: - (A) document that this is an override of a virtual function - (B) allow the compiler to issue a warning if it isn't (e.g. a mismatch - of the type signature). - - Similarly, it allows us to add a "final" to indicate that no subclass - may subsequently override the vfunc. - - Provide OVERRIDE and FINAL as macros, allowing us to get these benefits - when compiling with C++11 support, but without requiring C++11. - - For gcc, use "-std=c++11" to enable C++11 support; gcc 6 onwards enables - this by default (actually GNU++14). */ - -#if defined __cplusplus -# if __cplusplus >= 201103 - /* 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 -# endif -#else - /* No C++11 support; leave the macros empty. */ -# define OVERRIDE -# define FINAL -#endif - /* A macro to disable the copy constructor and assignment operator. When building with C++11 and above, the methods are explicitly deleted, causing a compile-time error if something tries to copy.