This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: integrated cpplib and nonexistant input
- To: Jakub Jelinek <jakub at redhat dot com>
- Subject: Re: integrated cpplib and nonexistant input
- From: Neil Booth <NeilB at earthling dot net>
- Date: Mon, 6 Nov 2000 19:09:13 +0000
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <20001104153937.Y6207@devserv.devel.redhat.com>
Jakub Jelinek wrote:-
> With integrated cpplib when somebody mistakenly starts cc1 or cc1plus with a
> non-existant file, the result is abort():
>
> c-lex.c:
> 223 if (! cpp_start_read (&parse_in, filename))
> 224 abort ();
>
> I don't think this is appropriate (eventhough the driver should ensure the
> input file exists, when debugging an ICE is quite strange), I think much
> better would be to exit with some non-zero code at this point.
Yes, here's a patch.
Neil.
* c-lex.c (init_c_lex): If cpp_start_read fails, exit with
error status.
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lex.c,v
retrieving revision 1.108
diff -u -p -r1.108 c-lex.c
--- c-lex.c 2000/11/06 18:43:30 1.108
+++ c-lex.c 2000/11/06 19:07:24
@@ -221,7 +221,7 @@ init_c_lex (filename)
CPP_OPTION (&parse_in, digraphs) = flag_digraphs;
if (! cpp_start_read (&parse_in, filename))
- abort ();
+ exit (FATAL_EXIT_CODE); /* cpplib has emitted an error. */
if (filename == 0 || !strcmp (filename, "-"))
filename = "stdin";