]> 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:42:28 +0000 (13:42 +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.

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

index 1647521555da5824edba7425f4b46ef26705d506..1f8afdd2c747fc23fd51bd1001a4abc5ed76ef0a 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 { }