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]

more location_t cleanups


Something mindless while waiting for other bugs...


r~



        * c-decl.c (duplicate_decls): Copy DECL_SOURCE_LOCATION, not
        file and line separately.

f/
        * com.c (duplicate_decls): Copy DECL_SOURCE_LOCATION, not
        file and line separately.
java/
        * check-init.c (check_init): Save and restore input_location
        instead of file and line separately.
        * decl.c (java_expand_body): Likewise.
        * jcf-write.c (generate_bytecode_insns): Likewise.
        * parse.y (safe_layout_class): Likewise.
        * jcf-parse.c (read_class, parse_class_file): Likewise.
        (java_parse_file): Use %H for warning locator.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.452
diff -u -p -u -r1.452 c-decl.c
--- c-decl.c	28 Sep 2003 04:37:36 -0000	1.452
+++ c-decl.c	28 Sep 2003 22:03:27 -0000
@@ -1305,10 +1305,7 @@ duplicate_decls (tree newdecl, tree oldd
 	 information so that meaningful diagnostics can be given.  */
       if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0
 	  && ! different_binding_level)
-	{
-	  DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
-	  DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
-	}
+	DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
 
       /* Merge the unused-warning information.  */
       if (DECL_IN_SYSTEM_HEADER (olddecl))
Index: f/com.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/com.c,v
retrieving revision 1.218
diff -u -p -u -r1.218 com.c
--- f/com.c	22 Sep 2003 05:09:30 -0000	1.218
+++ f/com.c	28 Sep 2003 22:03:42 -0000
@@ -13297,8 +13297,7 @@ duplicate_decls (tree newdecl, tree oldd
       if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0)
 	  || (DECL_CONTEXT (newdecl) != 0 && DECL_CONTEXT (olddecl) == 0))
 	{
-	  DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl);
-	  DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl);
+	  DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
 
 	  if (DECL_CONTEXT (olddecl) == 0
 	      && TREE_CODE (newdecl) != FUNCTION_DECL)
Index: java/check-init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/check-init.c,v
retrieving revision 1.52
diff -u -p -u -r1.52 check-init.c
--- java/check-init.c	21 Sep 2003 05:07:19 -0000	1.52
+++ java/check-init.c	28 Sep 2003 22:03:43 -0000
@@ -886,18 +886,16 @@ check_init (tree exp, words before)
 
     case EXPR_WITH_FILE_LOCATION:
       {
-	const char *saved_input_filename = input_filename;
+	location_t saved_location = input_location;
 	tree saved_wfl = wfl;
 	tree body = EXPR_WFL_NODE (exp);
-	int saved_lineno = input_line;
 	if (body == empty_stmt_node)
 	  break;
 	wfl = exp;
 	input_filename = EXPR_WFL_FILENAME (exp);
 	input_line = EXPR_WFL_LINENO (exp);
 	check_init (body, before);
-	input_filename = saved_input_filename;
-	input_line = saved_lineno;
+	input_location = saved_location;
 	wfl = saved_wfl;
       }
       break;
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.164
diff -u -p -u -r1.164 decl.c
--- java/decl.c	23 Sep 2003 03:05:30 -0000	1.164
+++ java/decl.c	28 Sep 2003 22:03:44 -0000
@@ -1817,12 +1817,10 @@ end_java_method (void)
 void
 java_expand_body (tree fndecl)
 {
-  const char *saved_input_filename = input_filename;
-  int saved_lineno = input_line;
+  location_t saved_location = input_location;
 
   current_function_decl = fndecl;
-  input_filename = DECL_SOURCE_FILE (fndecl);
-  input_line = DECL_SOURCE_LINE (fndecl);
+  input_location = DECL_SOURCE_LOCATION (fndecl);
 
   timevar_push (TV_EXPAND);
 
@@ -1859,8 +1857,7 @@ java_expand_body (tree fndecl)
 
   timevar_pop (TV_EXPAND);
 
-  input_filename = saved_input_filename;
-  input_line = saved_lineno;
+  input_location = saved_location;
 
   current_function_decl = NULL_TREE;
 }
Index: java/jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.145
diff -u -p -u -r1.145 jcf-parse.c
--- java/jcf-parse.c	22 Sep 2003 05:09:31 -0000	1.145
+++ java/jcf-parse.c	28 Sep 2003 22:03:45 -0000
@@ -472,7 +472,7 @@ read_class (tree name)
   JCF this_jcf, *jcf;
   tree icv, class = NULL_TREE;
   tree save_current_class = current_class;
-  const char *save_input_filename = input_filename;
+  location_t save_location = input_location;
   JCF *save_current_jcf = current_jcf;
 
   if ((icv = IDENTIFIER_CLASS_VALUE (name)) != NULL_TREE)
@@ -550,7 +550,7 @@ read_class (tree name)
     }
 
   current_class = save_current_class;
-  input_filename = save_input_filename;
+  input_location = save_location;
   current_jcf = save_current_jcf;
   return 1;
 }
@@ -703,8 +703,7 @@ static void
 parse_class_file (void)
 {
   tree method;
-  const char *save_input_filename = input_filename;
-  int save_lineno = input_line;
+  location_t save_location = input_location;
 
   java_layout_seen_class_methods ();
 
@@ -799,9 +798,8 @@ parse_class_file (void)
 
   finish_class ();
 
-  (*debug_hooks->end_source_file) (save_lineno);
-  input_filename = save_input_filename;
-  input_line = save_lineno;
+  (*debug_hooks->end_source_file) (save_location.line);
+  input_location = save_location;
 }
 
 /* Parse a source file, as pointed by the current value of INPUT_FILENAME. */
@@ -984,10 +982,11 @@ java_parse_file (int set_yydebug ATTRIBU
 
 	  if (twice)
 	    {
-	      const char *saved_input_filename = input_filename;
-	      input_filename = value;
-	      warning ("source file seen twice on command line and will be compiled only once");
-	      input_filename = saved_input_filename;
+	      location_t warn_loc;
+	      warn_loc.file = value;
+	      warn_loc.line = 0;
+	      warning ("%Hsource file seen twice on command line and "
+		       "will be compiled only once", &warn_loc);
 	    }
 	  else
 	    {
Index: java/jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.135
diff -u -p -u -r1.135 jcf-write.c
--- java/jcf-write.c	23 Sep 2003 15:49:53 -0000	1.135
+++ java/jcf-write.c	28 Sep 2003 22:03:48 -0000
@@ -1417,9 +1417,8 @@ generate_bytecode_insns (tree exp, int t
       break;
     case EXPR_WITH_FILE_LOCATION:
       {
-	const char *saved_input_filename = input_filename;
+	location_t saved_location = input_location;
 	tree body = EXPR_WFL_NODE (exp);
-	int saved_lineno = input_line;
 	if (body == empty_stmt_node)
 	  break;
 	input_filename = EXPR_WFL_FILENAME (exp);
@@ -1428,8 +1427,7 @@ generate_bytecode_insns (tree exp, int t
 	    && debug_info_level > DINFO_LEVEL_NONE)
 	  put_linenumber (input_line, state);
 	generate_bytecode_insns (body, target, state);
-	input_filename = saved_input_filename;
-	input_line = saved_lineno;
+	input_location = saved_location;
       }
       break;
     case INTEGER_CST:
Index: java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.446
diff -u -p -u -r1.446 parse.y
--- java/parse.y	28 Sep 2003 04:56:35 -0000	1.446
+++ java/parse.y	28 Sep 2003 22:04:00 -0000
@@ -5461,14 +5461,12 @@ void
 safe_layout_class (tree class)
 {
   tree save_current_class = current_class;
-  const char *save_input_filename = input_filename;
-  int save_lineno = input_line;
+  location_t save_location = input_location;
 
   layout_class (class);
 
   current_class = save_current_class;
-  input_filename = save_input_filename;
-  input_line = save_lineno;
+  input_location = save_location;
 }
 
 static tree


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