]> 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:56:03 +0000 (13:56 +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 973729d3d8a8393e8c03209e986155776be07a93..c61bf6216434179892f8492853ffa154ea4df4be 100644 (file)
@@ -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 (file)
index 0000000..8a9cca7
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-Wpadded" }
+
+class EmptyClass { }