This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]