From: Iain Buclaw Date: Wed, 15 Jun 2022 11:20:15 +0000 (+0200) Subject: d: Set TYPE_ARTIFICIAL on internal TypeInfo types X-Git-Tag: basepoints/gcc-14~6100 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57b2adae536a6399ed7d2c881b1bc0d4b88e936a;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc index 1647521555d..1f8afdd2c74 100644 --- a/gcc/d/typeinfo.cc +++ b/gcc/d/typeinfo.cc @@ -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 index 00000000000..8a9cca7e225 --- /dev/null +++ b/gcc/testsuite/gdc.dg/Wpadded.d @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "-Wpadded" } + +class EmptyClass { }