diff options
author | Marek Polacek <polacek@redhat.com> | 2022-05-17 13:41:56 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-05-17 18:03:54 -0400 |
commit | 2c05a2d1a8e4697ea95d65c5da601aeae327e7a7 (patch) | |
tree | 3263d3608a51b0ce0bd2f5bb44f5836ff76a20da /gcc/cp/decl.cc | |
parent | 2ee68beee709e48fce85b8892ff9985acc6a91a8 (diff) | |
download | gcc-2c05a2d1a8e4697ea95d65c5da601aeae327e7a7.zip gcc-2c05a2d1a8e4697ea95d65c5da601aeae327e7a7.tar.gz gcc-2c05a2d1a8e4697ea95d65c5da601aeae327e7a7.tar.bz2 |
c: use CONST_DECL for enumerators in TYPE_VALUES
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.
gcc/c/ChangeLog:
* c-decl.cc (finish_enum): Store the CONST_DECL into TREE_VALUE, not
its value.
gcc/ChangeLog:
* godump.cc (go_output_typedef): Use the DECL_INITIAL of the TREE_VALUE.
Diffstat (limited to 'gcc/cp/decl.cc')
0 files changed, 0 insertions, 0 deletions