public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* cpp help
@ 2008-04-02  8:15 Yaniv S.
  2008-04-03 16:49 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Yaniv S. @ 2008-04-02  8:15 UTC (permalink / raw)
  To: gcc-help

Hello all,

I want to use the cpp utility in order to get a map of an eeprom.
I have a quite dynamic header file which holds offset of the eeprom.

something like:

#define EEP_START 0

#define MMI_SOMETHING (EEP_START + 3)
...
#define MMI_END (EEP_START + 40)

#define CACHE_START MMI_END
#define RSSI_SOMETHING ( MMI_END + 4)

and so on.. and even some macro's based on previous defines to create offsets.

I wanted to be able to see absoloute numbers. I don't want to write
full utilitiy as it is done already be preprocessor but the cpp does
not return the wishful result, maybe because it is an header file.
The program itself uses this macros on various locations. some maybe not at all.

Is there a way to use CPP to help me?

Thanks in advance,
Yaniv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: cpp help
  2008-04-02  8:15 cpp help Yaniv S.
@ 2008-04-03 16:49 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2008-04-03 16:49 UTC (permalink / raw)
  To: Yaniv S.; +Cc: gcc-help

Yaniv S. wrote:
> Is there a way to use CPP to help me?

There is no easy way to get the info you want from the preprocessor.  It 
doesn't work that way.

You can use -E -dM to get a list of macro defined.  This will include 
system and compiler defined macros.  The macros will be expanded, but 
not evaluated, so you will have to manually perform some arithmetic to 
get the numbers you want.

Simpler might be to write a simple C file that prints out the macro 
values you want.

Jim

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-03 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-02  8:15 cpp help Yaniv S.
2008-04-03 16:49 ` Jim Wilson

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).