This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiler Directive to List Defined Macros?
- To: Ross Combs <rocombs at cs dot nmsu dot edu>
- Subject: Re: Compiler Directive to List Defined Macros?
- From: Neil Booth <NeilB at earthling dot net>
- Date: Fri, 30 Jun 2000 17:33:26 +0900
- Cc: martin at loewis dot home dot cs dot tu-berlin dot de, gcc at gcc dot gnu dot org
- References: <200006292249.QAA30985@quito.cs.nmsu.edu>
Ross Combs wrote:-
> Hmm. That is how I originally tried to use it. It is also annoying that
> I couldn't find a way to stringize __LINE__ and then concatenate it to
> __FILE__. But such things can be worked around.
You mean to get output like "\"myfile.c\": 200"? If so, the following
should work:
#define str(x) #x
#define xstr(x) str(x)
xstr(__FILE__: __LINE__)
Or if you want "myfile.c: 200", i.e. without the inner quotes, try
__FILE__ ": " xstr(__LINE__)
If you don't understand why this works, info cpp should help. If it
doesn't, please help us to improve the docs!
Neil.