forked from Imagelibrary/binutils-gdb
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>
32 lines
473 B
C
32 lines
473 B
C
#include <unistd.h>
|
|
|
|
struct foo_t
|
|
{
|
|
int foo;
|
|
size_t bar;
|
|
const char *baz;
|
|
struct foo_t *self;
|
|
const volatile union
|
|
{
|
|
double should_not_appear;
|
|
char *nor_should_this;
|
|
} named;
|
|
volatile const struct
|
|
{
|
|
long unnamed_sub_member;
|
|
union
|
|
{
|
|
double one_more_level;
|
|
long yes_really_one_more;
|
|
};
|
|
struct {
|
|
int and_finally;
|
|
};
|
|
};
|
|
struct {}; /* Empty ones */
|
|
union {};
|
|
int after_the_end;
|
|
};
|
|
|
|
struct foo_t used;
|