Identify struct members present after directives
Shakthi Kannan
shakthimaan@gmail.com
Thu Mar 15 09:19:00 GMT 2012
Hi,
Suppose there exists a struct foo such that:
=== test.c ===
struct foo {
int a;
int b;
#ifndef BAR
int c;
#endif
int d;
};
int
main (void)
{
struct foo x;
return 0;
}
=== END ===
I want to be able to find using a tool/parser if there exists a struct
member after the #ifndef BAR ... #endif directive.
If I use:
$ gcc -g -c test.c
$ readelf -w test.o
I am able to identify DW_TAG_members for a, b, and c. And when I use:
$ gcc -DBAR -g -c test.c
$ readelf -w test.o
I get the DW_TAG_member details only for a and c, and can tell the
difference. Is there any other way by which this can be checked?
Appreciate any inputs in this regard.
Thanks!
SK
--
Shakthi Kannan
http://www.shakthimaan.com
More information about the Gcc-help
mailing list