From patchwork Sun Apr 3 13:45:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1612747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=QV8c/42k; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KWZvf5Wylz9sFr for ; Sun, 3 Apr 2022 23:46:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 57A303857C44 for ; Sun, 3 Apr 2022 13:46:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57A303857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648993608; bh=Rg8AlEjBte4lCmZDERuPlRnQIQPJdZHesSIWAdIshnc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QV8c/42kvMCM4mDAhSQ4zKQTiDeCMInHW12vYfxFXj+Pwru1cNBX7WRAdZ2J4jBii 66Ou8H4tP2ufPjZxcH1aK/MlkfDtGDJsSOVKmoMWpBq4IVjUIdEGDA9MiC0uEk2G17 3BD20wWjYerEUm9tIosO512mn6zmklAhj42/6QRI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by sourceware.org (Postfix) with ESMTPS id E06AD3858D37 for ; Sun, 3 Apr 2022 13:46:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E06AD3858D37 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4KWZtg5t01z9sQj; Sun, 3 Apr 2022 15:46:03 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Remove Wtemplates warnings from the code generation pass Date: Sun, 3 Apr 2022 15:45:54 +0200 Message-Id: <20220403134554.1084669-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch removes the `-Wtemplate' warnings from the code generation pass of the D front-end. These have been superceded by the upstream front-end's own internal tracking of instantiations, exposed by `-ftransition=templates'. Bootstrapped on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * d-lang.cc: Include dmd/template.h. (d_parse_file): Call printTemplateStats when vtemplates is set. * decl.cc (start_function): Remove OPT_Wtemplates warning. * lang.opt (Wtemplates): Remove. --- gcc/d/d-lang.cc | 4 ++++ gcc/d/decl.cc | 11 +---------- gcc/d/lang.opt | 4 ---- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index 4a7aa8983b7..69571628336 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "dmd/module.h" #include "dmd/mtype.h" #include "dmd/target.h" +#include "dmd/template.h" #include "opts.h" #include "alias.h" @@ -1306,6 +1307,9 @@ d_parse_file (void) } } + if (global.params.vtemplates) + printTemplateStats (); + /* Generate JSON files. */ if (global.params.doJsonGeneration) { diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index ea8baef588c..86ea1761f4f 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -1891,16 +1891,7 @@ start_function (FuncDeclaration *fd) modules not in this compilation, or thunk aliases. */ TemplateInstance *ti = fd->isInstantiated (); if (ti && ti->needsCodegen ()) - { - /* Warn about templates instantiated in this compilation. */ - if (ti == fd->parent) - { - warning (OPT_Wtemplates, "%s %qs instantiated", - ti->kind (), ti->toPrettyChars (false)); - } - - DECL_EXTERNAL (fndecl) = 0; - } + DECL_EXTERNAL (fndecl) = 0; else { Module *md = fd->getModule (); diff --git a/gcc/d/lang.opt b/gcc/d/lang.opt index 7859e1583c8..51e8e5c7e00 100644 --- a/gcc/d/lang.opt +++ b/gcc/d/lang.opt @@ -138,10 +138,6 @@ Wspeculative D Warn from speculative compiles such as __traits(compiles). -Wtemplates -D -; Documented in C - Wunknown-pragmas D Var(warn_unknown_pragmas) LangEnabledBy(D, Wextra) ; Documented in C