summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-06-15 13:20:15 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-06-15 13:53:30 +0200
commit5f4931ec9926a7c8e680ba72fc437bb35dec3832 (patch)
tree958241e09680e5c19519dd43fc64a4ff322a2a05
parentFix ICE in extract_insn, at recog.cc:2791 (diff)
downloadgcc-5f4931ec9926a7c8e680ba72fc437bb35dec3832.tar.gz
gcc-5f4931ec9926a7c8e680ba72fc437bb35dec3832.tar.bz2
gcc-5f4931ec9926a7c8e680ba72fc437bb35dec3832.tar.xz
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)
-rw-r--r--gcc/d/typeinfo.cc1
-rw-r--r--gcc/testsuite/gdc.dg/Wpadded.d4
2 files changed, 5 insertions, 0 deletions
diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index 439380b7da9..45feb809a2d 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -180,6 +180,7 @@ make_internal_typeinfo (tinfo_kind tk, Identifier *ident, ...)
180 180
181 /* Create the TypeInfo type. */ 181 /* Create the TypeInfo type. */
182 tree type = make_node (RECORD_TYPE); 182 tree type = make_node (RECORD_TYPE);
183 TYPE_ARTIFICIAL (type) = 1;
183 finish_builtin_struct (type, ident->toChars (), fields, NULL_TREE); 184 finish_builtin_struct (type, ident->toChars (), fields, NULL_TREE);
184 185
185 tinfo_types[tk] = type; 186 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 @@
1// { dg-do compile }
2// { dg-options "-Wpadded" }
3
4class EmptyClass { }