public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Identify struct members present after directives
@ 2012-03-15  9:19 Shakthi Kannan
  0 siblings, 0 replies; only message in thread
From: Shakthi Kannan @ 2012-03-15  9:19 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-15  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15  9:19 Identify struct members present after directives Shakthi Kannan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).