This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Meaning of __BASE_FILE__ inside -include file?
- From: "Gary Funck" <gary at intrepid dot com>
- To: "Gcc Mailing List" <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Oct 2004 14:59:28 -0700
- Subject: Meaning of __BASE_FILE__ inside -include file?
Hello, given the following ident-like definition living inside
a header file:
/* Place configuration information required by the Berkeley
UPC compilation system into the object file. */
static const char GCCUPCConfig[] __attribute__ ((section("upc_pgm_info"))) =
"$GCCUPCConfig: (" __BASE_FILE__ ") "
__UPC_THREADS_CONFIG__ " " __UPC_THREADS_MODEL__ "$";
When this file is included via an expliict #include in the source program,
it generates the expected result.
However, when this file is (pre-) included via a -include switch
on the command line, __BASE_FILE__ expands as "<command line>"
(without the quotes).
__BASE_FILE__ is defined as follows:
This macro expands to the name of the main input file, in the form of a C
string constant. This is the source file that was specified on the command
line of the preprocessor or C compiler.
-----------
Is it reasonable to assume that __BASE_FILE__ should also produce the
expected result when invoked from a header file included via tha -include
switch? Are there significant implementation issues involved in supporting
this usage?