From 45a82bd9573cb4b385dca060f340d535b2c04e5f Mon Sep 17 00:00:00 2001
From: Per Bothner <bothner@bothner.com>
Date: Thu, 1 Jun 2006 16:18:34 +0000
Subject: [PATCH] data.c (gfc_assign_data_value): Handle USE_MAPPED_LOCATION.

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

From-SVN: r114310
---
 gcc/fortran/ChangeLog |  5 +++++
 gcc/fortran/data.c    |  6 ++++++
 gcc/fortran/scanner.c | 15 +++++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a91cb42baabc..eb093a75b6d1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-01  Per Bothner  <bothner@bothner.com>
+
+	* data.c (gfc_assign_data_value): Handle USE_MAPPED_LOCATION.
+	* scanner.c (gfc_gobble_whitespace): Likewise.
+
 2006-06-01  Paul Thomas  <pault@gcc.gnu.org>
 
 	PR fortran/25098
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 8fb8b5d08297..9f256bc7a9cf 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -325,8 +325,14 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index)
 	  /* 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;
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index d05d6034ebf8..7e0d6962d514 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -852,11 +852,18 @@ gfc_gobble_whitespace (void)
       /* 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));
-- 
GitLab