diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2025-02-24 18:11:25 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-02-28 14:16:42 +0000 |
commit | fa4fe2753730f412c00a8a2bab36550c063dfe95 (patch) | |
tree | cb5dd0b34e23d0cb57668b61fcdd208898c3cb11 /libctf/testsuite/libctf-lookup/struct-iteration-ctf.c | |
parent | 83e8a5d39be92d052986fe9d687a049db8f9f8c5 (diff) | |
download | binutils-fa4fe2753730f412c00a8a2bab36550c063dfe95.zip binutils-fa4fe2753730f412c00a8a2bab36550c063dfe95.tar.gz binutils-fa4fe2753730f412c00a8a2bab36550c063dfe95.tar.bz2 |
libctf: fix cv-qualified unnamed struct/union field lookup
GCC permits not only unnamed structs and unions, but cv-qualified ones.
Our earlier fix in 6c3a38777b38a2ad87e2b2bcec4567578d1c83ec supported
unnamed structs and unions, but only unqualified ones.
Resolving away cvr-quals of nameless fields (and, irrelevantly, typedefs)
is easy and fixes this problem.
Tests adjusted accordingly.
libctf/
PR libctf/32746
* ctf-types.c (ctf_member_next): Resolve away cv-quals.
(ctf_member_info): Likewise.
* testsuite/libctf-lookup/struct-iteration-ctf.c: Add a cv-qualified
type or two: make sure to keep a non-qualified one.
* testsuite/libctf-lookup/struct-iteration.c: Verify consistency
of ctf_member_next and ctf_member_info.
* testsuite/libctf-lookup/struct-iteration.lk: Adjust.
Tested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Diffstat (limited to 'libctf/testsuite/libctf-lookup/struct-iteration-ctf.c')
-rw-r--r-- | libctf/testsuite/libctf-lookup/struct-iteration-ctf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libctf/testsuite/libctf-lookup/struct-iteration-ctf.c b/libctf/testsuite/libctf-lookup/struct-iteration-ctf.c index 7df67ad..0a50d2c 100644 --- a/libctf/testsuite/libctf-lookup/struct-iteration-ctf.c +++ b/libctf/testsuite/libctf-lookup/struct-iteration-ctf.c @@ -6,12 +6,12 @@ struct foo_t size_t bar; const char *baz; struct foo_t *self; - union + const volatile union { double should_not_appear; char *nor_should_this; } named; - struct + volatile const struct { long unnamed_sub_member; union @@ -19,6 +19,9 @@ struct foo_t double one_more_level; long yes_really_one_more; }; + struct { + int and_finally; + }; }; struct {}; /* Empty ones */ union {}; |