On Tue, May 17, 2022 at 02:59:00PM -0700, Ian Lance Taylor wrote: > On Tue, May 17, 2022 at 2:46 PM Marek Polacek <pola...@redhat.com> wrote: > > > > On Tue, May 17, 2022 at 09:35:14PM +0000, Joseph Myers wrote: > > > On Tue, 17 May 2022, Marek Polacek via Gcc-patches wrote: > > > > > > > The C and C++ FEs differ in TYPE_VALUES for an enum type: an entry in > > > > the list in the C++ FE has a CONST_DECL in the TREE_VALUE, but the C FE > > > > has only the numerical value of the CONST_DECL there. This has caused > > > > me some trouble in my PR105497 patch. Using a CONST_DECL is preferable > > > > because a CONST_DECL can track more information (e.g., attributes), and > > > > you can always get the value simply by looking at its DECL_INITIAL. > > > > > > > > This turned out to be a trivial change. One place in godump.cc had to > > > > be > > > > adjusted. I'm not changing the CONST_DECL check in c_do_switch_warnings > > > > because I'll be changing it soon in my next patch. I didn't see any > > > > other > > > > checks that this patch makes redundant. > > > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > > > > > > > gcc/c/ChangeLog: > > > > > > > > * c-decl.cc (finish_enum): Store the CONST_DECL into TREE_VALUE, not > > > > its value. > > > > > > The C front-end changes are OK. > > > > Thanks. Ian, are the (more or less obvious) godump.cc changes also OK? > > Yes, that change is OK (assuming it works). Thanks.
Thanks. It still works, the code in question is tested by e.g. testsuite/gcc.misc-tests/godump-1.c. Marek