#line directive and -D option

Jan Engelhardt jengelh@medozas.de
Wed Dec 17 03:55:00 GMT 2008


On Wednesday 2008-12-17 03:37, John (Eljay) Love-Jensen wrote:

>Hi Hiroki,
>
>The __FILE__ is based on what you pass.
>
>gcc -c foo.c
>__FILE__ is "foo.c"
>
>gcc -c ././././foo.c
>__FILE__ is "././././foo.c"
>
>If you don't want the prefix, don't append the prefix.

Well sometimes that just is not possible; for example when
you do an out-of-srcdir build in an autotools project, aka:

	mkdir obj
	cd obj
	../configure

then the compiler will be invoked with lots of ../${filename}.c.
That's why I use basename.



More information about the Gcc-help mailing list