c-decl.c (pending_invalid_xref_file): Remove.
authorNathan Sidwell <nathan@codesourcery.com>
Sat, 3 May 2003 13:28:33 +0000 (13:28 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sat, 3 May 2003 13:28:33 +0000 (13:28 +0000)
* c-decl.c (pending_invalid_xref_file): Remove.
(pending_invalid_xref_line): Remove.
(pending_invalid_xref_location): New.
(lookup_label): Use location_t and input_location directly.
(lookup_tag): Likewise.
(pending_xref_error): Likewise.
(c_expand_body_1): Likewise.
* c-common.c (x_expand_start_cond): Likewise.
* c-semantics.c (genrtl_for_stmt): Likewise.
(find_reachable_label): Likewise.
* expr.c (expand_expr): Likewise.
* integrate.c (output_inline_function): Likewise.
* tree-inline.c (find_alloca_call): Likewise.
(find_builtin_longjmp_call): Likewise.
* gcc.c (input_filename): Make static.

From-SVN: r66425

gcc/ChangeLog
gcc/c-common.c
gcc/c-decl.c
gcc/c-semantics.c
gcc/expr.c
gcc/gcc.c
gcc/integrate.c
gcc/toplev.c
gcc/tree-inline.c

index 3da2fa0..41b878c 100644 (file)
@@ -1,3 +1,21 @@
+2003-05-03  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * c-decl.c (pending_invalid_xref_file): Remove.
+       (pending_invalid_xref_line): Remove.
+       (pending_invalid_xref_location): New.
+       (lookup_label): Use location_t and input_location directly.
+       (lookup_tag): Likewise.
+       (pending_xref_error): Likewise.
+       (c_expand_body_1): Likewise.
+       * c-common.c (x_expand_start_cond): Likewise.
+       * c-semantics.c (genrtl_for_stmt): Likewise.
+       (find_reachable_label): Likewise.
+       * expr.c (expand_expr): Likewise.
+       * integrate.c (output_inline_function): Likewise.
+       * tree-inline.c (find_alloca_call): Likewise.
+       (find_builtin_longjmp_call): Likewise.
+       * gcc.c (input_filename): Make static.
+       
 2003-05-03  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.md: Fix comment typo.
index c7e1cb0..e24bd3c 100644 (file)
@@ -918,8 +918,7 @@ c_expand_start_cond (cond, compstmt_count, if_stmt)
 
   /* Record this if statement.  */
   if_stack[if_stack_pointer].compstmt_count = compstmt_count;
-  if_stack[if_stack_pointer].locus.file = input_filename;
-  if_stack[if_stack_pointer].locus.line = input_line;
+  if_stack[if_stack_pointer].locus = input_location;
   if_stack[if_stack_pointer].needs_warning = 0;
   if_stack[if_stack_pointer].if_stmt = if_stmt;
   if_stack_pointer++;
index e35944e..11f7499 100644 (file)
@@ -65,8 +65,7 @@ enum decl_context
 
 tree pending_invalid_xref;
 /* File and line to appear in the eventual error message.  */
-const char *pending_invalid_xref_file;
-int pending_invalid_xref_line;
+location_t pending_invalid_xref_location;
 
 /* While defining an enum type, this is 1 plus the last enumerator
    constant value.  Note that will do not have to save this or `enum_overflow'
@@ -2019,8 +2018,7 @@ lookup_label (id)
 
   /* Say where one reference is to the label,
      for the sake of the error if it is not defined.  */
-  DECL_SOURCE_LINE (decl) = input_line;
-  DECL_SOURCE_FILE (decl) = input_filename;
+  DECL_SOURCE_LOCATION (decl) = input_location;
 
   IDENTIFIER_LABEL_VALUE (id) = decl;
 
@@ -2183,8 +2181,7 @@ lookup_tag (code, name, thislevel_only)
     {
       /* Definition isn't the kind we were looking for.  */
       pending_invalid_xref = name;
-      pending_invalid_xref_file = input_filename;
-      pending_invalid_xref_line = input_line;
+      pending_invalid_xref_location = input_location;
 
       /* If in the same binding level as a declaration as a tag
         of a different type, this must not be allowed to
@@ -2205,8 +2202,8 @@ void
 pending_xref_error ()
 {
   if (pending_invalid_xref != 0)
-    error_with_file_and_line (pending_invalid_xref_file,
-                             pending_invalid_xref_line,
+    error_with_file_and_line (pending_invalid_xref_location.file,
+                             pending_invalid_xref_location.line,
                              "`%s' defined as wrong kind of tag",
                              IDENTIFIER_POINTER (pending_invalid_xref));
   pending_invalid_xref = 0;
@@ -6337,9 +6334,8 @@ c_expand_body_1 (fndecl, nested_p)
 
   /* Initialize the RTL code for the function.  */
   current_function_decl = fndecl;
-  input_filename = DECL_SOURCE_FILE (fndecl);
+  input_location = DECL_SOURCE_LOCATION (fndecl);
   init_function_start (fndecl, input_filename, DECL_SOURCE_LINE (fndecl));
-  input_line = DECL_SOURCE_LINE (fndecl);
 
   /* This function is being processed in whole-function mode.  */
   cfun->x_whole_function_mode_p = 1;
index 522d563..59620ca 100644 (file)
@@ -543,8 +543,7 @@ genrtl_for_stmt (t)
      tree t;
 {
   tree cond = FOR_COND (t);
-  const char *saved_filename;
-  int saved_lineno;
+  location_t saved_loc;
 
   if (NEW_FOR_SCOPE_P (t))
     genrtl_do_pushlevel ();
@@ -562,8 +561,7 @@ genrtl_for_stmt (t)
 
   /* Save the filename and line number so that we expand the FOR_EXPR
      we can reset them back to the saved values.  */
-  saved_filename = input_filename;
-  saved_lineno = input_line;
+  saved_loc = input_location;
 
   /* Expand the condition.  */
   if (cond && !integer_nonzerop (cond))
@@ -578,8 +576,7 @@ genrtl_for_stmt (t)
   expand_stmt (FOR_BODY (t));
 
   /* Expand the increment expression.  */
-  input_filename = saved_filename;
-  input_line = saved_lineno;
+  input_location = saved_loc;
   emit_line_note (input_filename, input_line);
   if (FOR_EXPR (t))
     {
@@ -952,11 +949,9 @@ static tree
 find_reachable_label (exp)
      tree exp;
 {
-  int line = input_line;
-  const char *file = input_filename;
+  location_t saved_loc = input_location;
   tree ret = walk_tree (&exp, find_reachable_label_1, NULL, NULL);
-  input_filename = file;
-  input_line = line;
+  input_location = saved_loc;
   return ret;
 }
 
index cbd4811..bc316b3 100644 (file)
@@ -6932,16 +6932,14 @@ expand_expr (exp, target, tmode, modifier)
     case EXPR_WITH_FILE_LOCATION:
       {
        rtx to_return;
-       const char *saved_input_filename = input_filename;
-       int saved_lineno = input_line;
+       location_t saved_loc = input_location;
        input_filename = EXPR_WFL_FILENAME (exp);
        input_line = EXPR_WFL_LINENO (exp);
        if (EXPR_WFL_EMIT_LINE_NOTE (exp))
          emit_line_note (input_filename, input_line);
        /* Possibly avoid switching back and forth here.  */
        to_return = expand_expr (EXPR_WFL_NODE (exp), target, tmode, modifier);
-       input_filename = saved_input_filename;
-       input_line = saved_lineno;
+       input_location = saved_loc;
        return to_return;
       }
 
index 8bfc084..ec6c83a 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4150,7 +4150,7 @@ set_collect_gcc_options ()
    sans all directory names, and basename_length is the number
    of characters starting there excluding the suffix .c or whatever.  */
 
-const char *input_filename;
+static const char *input_filename;
 static int input_file_number;
 size_t input_filename_length;
 static int basename_length;
index 3e7f94b..3c0b42a 100644 (file)
@@ -3040,8 +3040,7 @@ output_inline_function (fndecl)
 
   /* Make sure warnings emitted by the optimizers (e.g. control reaches
      end of non-void function) is not wildly incorrect.  */
-  input_filename = DECL_SOURCE_FILE (fndecl);
-  input_line = DECL_SOURCE_LINE (fndecl);
+  input_location = DECL_SOURCE_LOCATION (fndecl);
 
   /* Compile this function all the way down to assembly code.  As a
      side effect this destroys the saved RTL representation, but
index fc25ca4..065952b 100644 (file)
@@ -2130,9 +2130,9 @@ check_global_declarations (vec, len)
     }
 }
 
-/* Save the current INPUT_FILENAME and LINENO on the top entry in the
+/* Save the current INPUT_LOCATION on the top entry in the
    INPUT_FILE_STACK.  Push a new entry for FILE and LINE, and set the
-   INPUT_FILENAME and LINENO accordingly.  */
+   INPUT_LOCATION accordingly.  */
 
 void
 push_srcloc (file, line)
@@ -2154,8 +2154,8 @@ push_srcloc (file, line)
 }
 
 /* Pop the top entry off the stack of presently open source files.
-   Restore the INPUT_FILENAME and LINENO from the new topmost entry on
-   the stack.  */
+   Restore the INPUT_LOCATION from the new topmost entry on the
+   stack.  */
 
 void
 pop_srcloc ()
index cb6b0c4..d2cf66a 100644 (file)
@@ -900,11 +900,9 @@ static tree
 find_alloca_call (exp)
      tree exp;
 {
-  int line = input_line;
-  const char *file = input_filename;
+  location_t saved_loc = input_location;
   tree ret = walk_tree (&exp, find_alloca_call_1, NULL, NULL);
-  input_line = line;
-  input_filename = file;
+  input_location = saved_loc;
   return ret;
 }
 
@@ -931,11 +929,9 @@ static tree
 find_builtin_longjmp_call (exp)
      tree exp;
 {
-  int line = input_line;
-  const char *file = input_filename;
+  location_t saved_loc = input_location;
   tree ret = walk_tree (&exp, find_builtin_longjmp_call_1, NULL, NULL);
-  input_line = line;
-  input_filename = file;
+  input_location = saved_loc;
   return ret;
 }