diff mbox

[1/9] java: Convert implicit uses of input_location into explicit uses

Message ID 1385091069-23732-2-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Nov. 22, 2013, 3:31 a.m. UTC
gcc/java
	* class.c (maybe_layout_super_class): Update comment.
	* decl.c (java_add_stmt): Remove use of input_filename macro.
	* jcf-parse.c (set_source_filename): Remove use of
	input_filename macro.
	(parse_class_file): Remove use of input_line and input_filename
	macros.
	(java_parse_file): Remove use of input_filename macro.
---
 gcc/java/class.c     |  2 +-
 gcc/java/decl.c      |  2 +-
 gcc/java/jcf-parse.c | 18 +++++++++++-------
 3 files changed, 13 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/gcc/java/class.c b/gcc/java/class.c
index 58bc92f..532c9c1 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -2415,7 +2415,7 @@  maybe_layout_super_class (tree super_class, tree this_class ATTRIBUTE_UNUSED)
 }
 
 /* safe_layout_class just makes sure that we can load a class without
-   disrupting the current_class, input_file, input_line, etc, information
+   disrupting the current_class, input_location, etc, information
    about the class processed currently.  */
 
 void
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 70e21b0..39b76a5 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -2018,7 +2018,7 @@  java_add_stmt (tree new_stmt)
   tree stmts = current_binding_level->stmts;
   tree_stmt_iterator i;
 
-  if (input_filename)
+  if (LOCATION_FILE (input_location))
     walk_tree (&new_stmt, set_input_location, NULL, NULL);
 
   if (stmts == NULL)
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 9799523..b6f099a 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -313,13 +313,14 @@  set_source_filename (JCF *jcf, int index)
 {
   tree sfname_id = get_name_constant (jcf, index);
   const char *sfname = IDENTIFIER_POINTER (sfname_id);
-  const char *old_filename = input_filename;
+  const char *old_filename = LOCATION_FILE (input_location);
   int new_len = IDENTIFIER_LENGTH (sfname_id);
   if (old_filename != NULL)
     {
       int old_len = strlen (old_filename);
-      /* Use the current input_filename (derived from the class name)
-	 if it has a directory prefix, but otherwise matches sfname. */
+      /* Use the filename from current input_location (derived from the
+	 class name) if it has a directory prefix, but otherwise matches
+	 sfname.  */
       if (old_len > new_len
 	  && filename_cmp (sfname, old_filename + old_len - new_len) == 0
 	  && (old_filename[old_len - new_len - 1] == '/'
@@ -1560,7 +1561,8 @@  parse_class_file (void)
     linemap_add (line_table, LC_ENTER, 0, loc.file, loc.line);
   }
   file_start_location = input_location;
-  (*debug_hooks->start_source_file) (input_line, input_filename);
+  (*debug_hooks->start_source_file) (LOCATION_LINE (input_location),
+				     LOCATION_FILE (input_location));
 
   java_mark_class_local (current_class);
 
@@ -1618,7 +1620,8 @@  parse_class_file (void)
 	  for (ptr += 2; --i >= 0; ptr += 4)
 	    {
 	      int line = GET_u2 (ptr);
-	      /* Set initial input_line to smallest linenumber.
+	      /* Set initial line of input_location to smallest
+	       * linenumber.
 	       * Needs to be set before init_function_start. */
 	      if (min_line == 0 || line < min_line)
 		min_line = line;
@@ -1748,7 +1751,7 @@  java_parse_file (void)
       int avail = 2000;
       finput = fopen (main_input_filename, "r");
       if (finput == NULL)
-	fatal_error ("can%'t open %s: %m", input_filename);
+	fatal_error ("can%'t open %s: %m", LOCATION_FILE (input_location));
       list = XNEWVEC (char, avail);
       next = list;
       for (;;)
@@ -1767,7 +1770,8 @@  java_parse_file (void)
 	  if (count == 0)
 	    {
 	      if (! feof (finput))
-		fatal_error ("error closing %s: %m", input_filename);
+		fatal_error ("error closing %s: %m",
+			     LOCATION_FILE (input_location));
 	      *next = '\0';
 	      break;
 	    }