This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Who should set main_input_filename to "<stdin>"?
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc at gcc dot gnu dot org, <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 27 Sep 2003 12:42:34 -0600 (MDT)
- Subject: Who should set main_input_filename to "<stdin>"?
Whilst debugging in gdb, I accidentally ran the command "jc1 -O2",
i.e. without a filename, only to discover than jc1 ICEs. Similar
tests reveal that mainline f771 also ICEs, but neither did back
in gcc 3.2. I then tried to discover why neither cc1 nor cc1plus
currently ICE, which revealed that mysteriously for the C-family
front-ends, main_input_filename gets set to "<stdin>" as an
undocumented side-effect of linemap_add in linemap.c.
I was wondering which routine *should* be responsible for setting
input filename? Should java and fortran be calling linemap earlier?
Should "default_file_start" in varasm.c call output_file_directive
when main_input_filename is NULL? Or if so, is it reasonable to
generate ".file <stdin>" in asm_out_file. Do java_parse_file and
ffe_parse_file now need to defend against NULL filenames?
This is one of those pan front-end problems that its difficult to
file as a f77 or java PR, as neither of them is at fault: something
else has obviously changed in toplev.c. I'm happy to investigate
a fix myself, but I don't yet know what the intended behaviour is
(or should be)?
Roger
--