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: Tom Tromey <tromey at redhat dot com>
- To: Gary Funck <gary at intrepid dot com>
- Cc: Gcc Patches <gcc-patches at gcc dot gnu dot org>, per at bothner dot com
- Date: Fri, 06 Jan 2012 08:34:52 -0700
- Subject: Re: [PING] PR33919/preprocessor fix __BASE_FILE__ when included from the command line
- References: <20111222035946.GA26878@intrepid.com> <20120102172347.GL22084@intrepid.com>
>>>>> "Gary" == Gary Funck <gary@intrepid.com> writes:
Gary> I have a specific question re: this new code.
Gary> + name = _cpp_get_file_name (pfile->main_file);
Gary> + if (!name)
Gary> + name = "<unknown>";
Gary> I wasn't sure whether 'name' can have a NULL value, and handled
Gary> that case as shown above. Would a gcc_assert() be more
Gary> appropriate, or is it safe to simply assume that the name
Gary> value is not NULL?
I think you can assume that it is not NULL.
libcpp can't use gcc_assert, but if you really want you could do
if (!name)
abort ();
The patch is ok with either that change or with those 2 lines removed.
Thanks for doing this.
Tom