public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r10-10845] d: Set TYPE_ARTIFICIAL on internal TypeInfo types
Date: Wed, 15 Jun 2022 11:56:20 +0000 (GMT)	[thread overview]
Message-ID: <20220615115620.F281F385734C@sourceware.org> (raw)

https://gcc.gnu.org/g:b524caf88624a59977297535db74f81d37529a28

commit r10-10845-gb524caf88624a59977297535db74f81d37529a28
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Jun 15 13:20:15 2022 +0200

    d: Set TYPE_ARTIFICIAL on internal TypeInfo types
    
    Prevents them from triggering warnings when compiling with `-Wpadded'.
    
    gcc/d/ChangeLog:
    
            * typeinfo.cc (make_internal_typeinfo): Set TYPE_ARTIFICIAL.
    
    gcc/testsuite/ChangeLog:
    
            * gdc.dg/Wpadded.d: New test.
    
    (cherry picked from commit 57b2adae536a6399ed7d2c881b1bc0d4b88e936a)

Diff:
---
 gcc/d/typeinfo.cc              | 1 +
 gcc/testsuite/gdc.dg/Wpadded.d | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index 973729d3d8a..c61bf621643 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -179,6 +179,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 { }


                 reply	other threads:[~2022-06-15 11:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615115620.F281F385734C@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).