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]

Re: integrated cpplib and nonexistant input


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";

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