public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10845] d: Set TYPE_ARTIFICIAL on internal TypeInfo types
@ 2022-06-15 11:56 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2022-06-15 11:56 UTC (permalink / raw)
  To: gcc-cvs

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 { }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-15 11:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 11:56 [gcc r10-10845] d: Set TYPE_ARTIFICIAL on internal TypeInfo types Iain Buclaw

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).