From patchwork Wed Jun 15 11:56:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1643694 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=kLBIY5R6; 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 (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNP1c6Gzzz9tl5 for ; Wed, 15 Jun 2022 21:57:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21D10385274E for ; Wed, 15 Jun 2022 11:57:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21D10385274E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1655294240; bh=0V7mthHxDYc2mxXzLDi1Becx7Zv6771lzZPcXd/GWWM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kLBIY5R6WJOgjFg5li635nwh/JPD8pekqY7RiPOetLzq/ILVGbEfl0NB6KV76Ly9t xhrU0xx/u/1J8B57r9/MdjZuihR1Y5ncNNDNrn7KIymydK4q9fYP6BrIobiwLhDVR6 V5a/EX7o0aGMI9C/CXeDV+7e3SldaVjZa4cVOAwk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id A10EB385734C for ; Wed, 15 Jun 2022 11:56:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A10EB385734C Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (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-102.mailbox.org (Postfix) with ESMTPS id 4LNP1351Gyz9sRm; Wed, 15 Jun 2022 13:56:55 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Set TYPE_ARTIFICIAL on internal TypeInfo types Date: Wed, 15 Jun 2022 13:56:53 +0200 Message-Id: <20220615115653.3793839-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 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.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: 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 sets the TYPE_ARTIFICIAL flag on internally generated object.TypeInfo types, preventing them from triggering warnings when compiling with `-Wpadded'. Regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline, and backported to the release/gcc-10, gcc-11, and gcc-12 branches. Regards, Iain. --- gcc/d/ChangeLog: * typeinfo.cc (make_internal_typeinfo): Set TYPE_ARTIFICIAL. gcc/testsuite/ChangeLog: * gdc.dg/Wpadded.d: New test. --- gcc/d/typeinfo.cc | 1 + gcc/testsuite/gdc.dg/Wpadded.d | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 gcc/testsuite/gdc.dg/Wpadded.d diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc index 1647521555d..1f8afdd2c74 100644 --- a/gcc/d/typeinfo.cc +++ b/gcc/d/typeinfo.cc @@ -180,6 +180,7 @@ make_internal_typeinfo (tinfo_kind tk, Identifier *ident, ...) /* Create the TypeInfo type. */ tree type = make_node (RECORD_TYPE); + TYPE_ARTIFICIAL (type) = 1; finish_builtin_struct (type, ident->toChars (), fields, NULL_TREE); tinfo_types[tk] = type; diff --git a/gcc/testsuite/gdc.dg/Wpadded.d b/gcc/testsuite/gdc.dg/Wpadded.d new file mode 100644 index 00000000000..8a9cca7e225 --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wpadded.d @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-Wpadded" } + +class EmptyClass { }