This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line
- From: Gary Funck <gary at intrepid dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Gcc Patches <gcc-patches at gcc dot gnu dot org>, per at bothner dot com
- Date: Fri, 6 Jan 2012 11:49:46 -0800
- Subject: Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line
- References: <20111222035946.GA26878@intrepid.com> <20120102172347.GL22084@intrepid.com> <m3hb083kv7.fsf@fleche.redhat.com>
On 01/06/12 08:34:52, Tom Tromey wrote:
Tom> The patch is ok with either that change or with those 2 lines removed.
Tom, thanks for the review. Another question ...
The test case tries to sanity check the __FILE__ value
by comparing the 'basename' part.
#define BASE_NAME "pr33919.c"
int
main ()
{
size_t file_len = strlen (__FILE__);
size_t basename_len = strlen (BASE_NAME);
if (file_len < basename_len)
abort ();
if (strcmp (__FILE__ + file_len - basename_len, BASE_NAME))
abort ();
[...]
which probably works fine on most systems, but perhaps
not so well if the OS upper cases all file names?
I can either remove the check, or change it so
that it just compares to make sure that __BASE_FILE__
isn't equal to "<command line>", which is the
problem documented in the bug report.
- Gary