This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Identify struct members present after directives


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]