Files
binutils-gdb/libctf/testsuite/libctf-lookup/struct-iteration.lk
Nick Alcock fa4fe27537 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 6c3a38777b 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>
2025-02-28 14:16:42 +00:00

27 lines
1.6 KiB
Plaintext

# source: struct-iteration-ctf.c
# link: on
iter test: foo, offset [0-9a-f]*, has type [0-9a-f]*/int
iter test: bar, offset [0-9a-f]*, has type [0-9a-f]*/size_t
iter test: baz, offset [0-9a-f]*, has type [0-9a-f]*/const char \*
iter test: self, offset [0-9a-f]*, has type [0-9a-f]*/struct foo_t \*
iter test: named, offset [0-9a-f]*, has type [0-9a-f]*/volatile const union
iter test: , offset [0-9a-f]*, has type [0-9a-f]*/volatile const struct
iter test: , offset [0-9a-f]*, has type [0-9a-f]*/struct
iter test: , offset [0-9a-f]*, has type [0-9a-f]*/union
iter test: after_the_end, offset [0-9a-f]*, has type [0-9a-f]*/int
next test: foo, offset [0-9a-f]*, has type [0-9a-f]*/int
next test: bar, offset [0-9a-f]*, has type [0-9a-f]*/size_t
next test: baz, offset [0-9a-f]*, has type [0-9a-f]*/const char \*
next test: self, offset [0-9a-f]*, has type [0-9a-f]*/struct foo_t \*
next test: named, offset [0-9a-f]*, has type [0-9a-f]*/volatile const union
next test: , offset [0-9a-f]*, has type [0-9a-f]*/volatile const struct
next test: unnamed_sub_member, offset [0-9a-f]*, has type [0-9a-f]*/long int
next test: , offset [0-9a-f]*, has type [0-9a-f]*/union
next test: one_more_level, offset [0-9a-f]*, has type [0-9a-f]*/double
next test: yes_really_one_more, offset [0-9a-f]*, has type [0-9a-f]*/long int
next test: , offset [0-9a-f]*, has type [0-9a-f]*/struct
next test: and_finally, offset [0-9a-f]*, has type [0-9a-f]*/int
next test: , offset [0-9a-f]*, has type [0-9a-f]*/struct
next test: , offset [0-9a-f]*, has type [0-9a-f]*/union
next test: after_the_end, offset [0-9a-f]*, has type [0-9a-f]*/int