]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Set TYPE_ARTIFICIAL on internal TypeInfo types
authorIain Buclaw <ibuclaw@gdcproject.org>
Wed, 15 Jun 2022 11:20:15 +0000 (13:20 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 15 Jun 2022 11:53:30 +0000 (13:53 +0200)
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)

gcc/d/typeinfo.cc
gcc/testsuite/gdc.dg/Wpadded.d [new file with mode: 0644]

index 439380b7da93e829047c2a51a5c2768d0485d422..45feb809a2ddc2dd6cc5c1385d07a2f3b7f663ce 100644 (file)
@@ -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 (file)
index 0000000..8a9cca7
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-Wpadded" }
+
+class EmptyClass { }