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]
Other format: [Raw text]

[patch, fortran] Fix USE_MAPPED_LOCATION regressions


This allows --enable-mapped-location --enable-languages=fortran
to bootstrap.  Ok for the trunk?
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/
2006-05-16  Per Bothner  <per@bothner.com>

	* data.c (gfc_assign_data_value): Handle USE_MAPPED_LOCATION.
	* scaner.c (gfc_gobble_whitespace): Likewise.

Index: data.c
===================================================================
--- data.c	(revision 113796)
+++ data.c	(working copy)
@@ -322,8 +322,14 @@
 	  /* Order in which the expressions arrive here depends on whether they
 	     are from data statements or F95 style declarations. Therefore,
 	     check which is the most recent.  */
+#ifdef USE_MAPPED_LOCATION
+	  expr = (LOCATION_LINE (init->where.lb->location)
+		  > LOCATION_LINE (rvalue->where.lb->location))
+	    ? init : rvalue;
+#else
 	  expr = (init->where.lb->linenum > rvalue->where.lb->linenum) ?
 		    init : rvalue;
+#endif
 	  gfc_notify_std (GFC_STD_GNU, "Extension: re-initialization "
 			  "of '%s' at %L",  symbol->name, &expr->where);
 	  return;
Index: scanner.c
===================================================================
--- scanner.c	(revision 113796)
+++ scanner.c	(working copy)
@@ -852,11 +852,18 @@
       /* Issue a warning for nonconforming tabs.  We keep track of the line
 	 number because the Fortran matchers will often back up and the same
 	 line will be scanned multiple times.  */
-      if (!gfc_option.warn_tabs && c == '\t'
-	  && gfc_current_locus.lb->linenum != linenum)
+      if (!gfc_option.warn_tabs && c == '\t')
 	{
-	  linenum = gfc_current_locus.lb->linenum;
-	  gfc_warning_now ("Nonconforming tab character at %C");
+#ifdef USE_MAPPED_LOCATION
+	  int cur_linenum = LOCATION_LINE (gfc_current_locus.lb->location);
+#else
+	  int cur_linenum = gfc_current_locus.lb->linenum;
+#endif
+	  if (cur_linenum != linenum)
+	    {
+	      linenum = cur_linenum;
+	      gfc_warning_now ("Nonconforming tab character at %C");
+	    }
 	}
     }
   while (gfc_is_whitespace (c));

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