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


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

jc1 patch to set input_filename for source file


Gdb was complaining about line numbers being out of range.  This turned
out to be because when compiling multiple source files at once, the
value of input_filename at various times was that of the
temporary file-containing-list-of-filenames, rather than any of the
actual source files.  This seems to fix the problem, so I checked it in.

2001-03-15  Per Bothner  <per@bothner.com>

	* jcf-parse.c (yyparse):  Set/reset input_filename for source file.
	* parse.y (java_expand_classes):  Likewise.

Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.77
diff -u -p -r1.77 jcf-parse.c
--- jcf-parse.c	2001/02/24 03:28:39	1.77
+++ jcf-parse.c	2001/03/16 06:06:58
@@ -1064,8 +1064,10 @@ yyparse ()
 
   for (ctxp = ctxp_for_generation;  ctxp;  ctxp = ctxp->next)
     {
+      input_filename = ctxp->filename;
       parse_source_file_2 ();
     }
+  input_filename = main_input_filename;
 
   java_expand_classes ();
   if (!java_report_errors () && !flag_syntax_only)
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.259
diff -u -p -r1.259 parse.y
--- parse.y	2001/03/16 05:57:29	1.259
+++ parse.y	2001/03/16 06:07:07
@@ -8621,10 +8621,12 @@ java_expand_classes ()
   for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
     {
       ctxp = ctxp_for_generation;
+      input_filename = ctxp->filename;
       lang_init_source (2);	       /* Error msgs have method prototypes */
       java_complete_expand_classes (); /* Complete and expand classes */
       java_parse_abort_on_error ();
     }
+  input_filename = main_input_filename;
 
   /* Find anonymous classes and expand their constructor, now they
      have been fixed. */
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


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