> On 26/10/2021 03:28 Joseph Myers <jos...@codesourcery.com> wrote: > > > On Mon, 25 Oct 2021, Richard Biener via Gcc-patches wrote: > > > So it looks like tm_d.h is much more stripped down compared to regular > > tm_p.h but also oddly enough config/default-d.c includes tm_d.h > > while config/default-c.c explicitely documents itself to not do that. > > I think the intent of that comment in default-c.c (which I wrote) was that > if a separate tm_c.h is needed, it should use its own headers, disjoint > from those used by tm.h. In particular, as noted in the original patch > submission > <https://gcc.gnu.org/legacy-ml/gcc-patches/2011-04/msg00434.html>, that > avoids making macros used only to define hooks visible throughout the > compiler. > > > Is it maybe a bug that tm_d.h includes defaults.h at all? Should > > It's a bug that it includes defaults.h, and a bug that it includes > ${cpu_type}/${cpu_type}.h. Any macros used only to define D hooks should > be in completely separate headers that aren't used elsewhere in the > compiler. > > > "d defaults" be in a defaults-d.h instead? If I remove the > > Yes, and likewise any target-specific overrides of such macros should be > in a separate header, not ${cpu_type}/${cpu_type}.h. >
So the what default-d.c is doing, is pulling down per-CPU back-end information to populate the targetdm structure where there's a supported CPU, but not platform. The why it is doing that was I wanted to avoid both having #ifdef's in the D front-end, and altering gcc/target.def. It seems then that either all TARGET_D_ macros should be moved to ${cpu_type}/${cpu_type}-d.h, or do one of alternatives I was trying to avoid. Iain.