Makefile.in (TREE_H): Replace location.h with input.h.
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 2 May 2003 11:33:06 +0000 (11:33 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 2 May 2003 11:33:06 +0000 (11:33 +0000)
* Makefile.in (TREE_H): Replace location.h with input.h.
(GTFILES) Remove location.h
(gt-lists.h): Replace gt-location.h with gt-input.h
* input.h (input_filename, input_line): Remove variables.
(location_s, location_t): Move from location.h.
(input_location): New.
(input_filename, input_line): New #defines.
* location.h: Remove.
* tree.h: Replace location.h with input.h.
(input_filename, input_line): Remove.
* diagnostic.h: Replace location.h with input.h.
* gcc.h (input_filename, input_filename_length): Remove declarations.
* toplev.c (input_filename, input_line): Remove.
(input_location): Define.
(push_srcloc, pop_srcloc): Adjust.
* diagnostic.c (diagnostic_report_current_module): Adjust.
f:
* lex.c (ffelex_file_pop_): Adjust file_stack member use.
(ffelex_file_push_): Likewise.
(ffelex_hash_): Likewise.
java:
* lex.h (input_lineno): Remove declaration.
* parse-scan.y: #include input.h.
(input_filename): Remove declaration.
(input_location): Add definition.
(input_line): Remove definition.

From-SVN: r66378

14 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/diagnostic.c
gcc/diagnostic.h
gcc/f/ChangeLog
gcc/f/lex.c
gcc/gcc.h
gcc/input.h
gcc/java/ChangeLog
gcc/java/lex.h
gcc/java/parse-scan.y
gcc/location.h [deleted file]
gcc/toplev.c
gcc/tree.h

index 70d97b21ebeebb6a612e7631691df206ac5362f7..1509141d34f61fb1da1f7c9935befa7439eeb0cc 100644 (file)
@@ -1,3 +1,22 @@
+2003-05-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * Makefile.in (TREE_H): Replace location.h with input.h.
+       (GTFILES) Remove location.h
+       (gt-lists.h): Replace gt-location.h with gt-input.h
+       * input.h (input_filename, input_line): Remove variables.
+       (location_s, location_t): Move from location.h.
+       (input_location): New.
+       (input_filename, input_line): New #defines.
+       * location.h: Remove.
+       * tree.h: Replace location.h with input.h.
+       (input_filename, input_line): Remove.
+       * diagnostic.h: Replace location.h with input.h.
+       * gcc.h (input_filename, input_filename_length): Remove declarations.
+       * toplev.c (input_filename, input_line): Remove.
+       (input_location): Define.
+       (push_srcloc, pop_srcloc): Adjust.
+       * diagnostic.c (diagnostic_report_current_module): Adjust.
+
 2003-05-02  Nick Clifton  <nickc@redhat.com>
 
        * configure.in: Add xstormy16 to list of targets that has a nop
index 96da3cec8daaed7a8085798ca6997a17f73e6e91..7847d9a9dc1ad78a09f87ab8d1fdc905294d583e 100644 (file)
@@ -633,7 +633,7 @@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H)
 RTL_H = $(RTL_BASE_H) genrtl.h
 PARAMS_H = params.h params.def
 TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \
-          location.h
+          input.h
 BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
           hard-reg-set.h
 COVERAGE_H = coverage.h gcov-io.h gcov-iov.h
@@ -1968,12 +1968,12 @@ s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
        $(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
        $(STAMP) s-preds
 
-GTFILES = $(srcdir)/location.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \
+GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \
   $(host_xm_file_list) $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) \
   $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h  $(srcdir)/rtl.h \
   $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
   $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/ssa.h $(srcdir)/insn-addr.h \
-  $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/location.h \
+  $(srcdir)/cselib.h $(srcdir)/basic-block.h \
   $(srcdir)/c-common.h $(srcdir)/c-tree.h \
   $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
   $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
@@ -1999,7 +1999,7 @@ gt-lists.h gt-alias.h gt-cselib.h gt-fold-const.h gt-gcse.h \
 gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h \
 gt-dwarf2out.h gt-ra-build.h gt-reg-stack.h gt-dwarf2asm.h \
 gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parse.h \
-gt-c-pragma.h gt-c-objc-common.h gtype-c.h gt-location.h \
+gt-c-pragma.h gt-c-objc-common.h gtype-c.h gt-input.h \
 gt-stringpool.h : s-gtype ; @true
 
 gtyp-gen.h: Makefile
index 565e073c5738041931f864074ea9e85e7dee020f..98c3bf0032cc11adc0e2c6b1939dcfc3ed7a1875 100644 (file)
@@ -1383,11 +1383,11 @@ diagnostic_report_current_module (context)
        if (p == input_file_stack->next)
          output_verbatim (&context->buffer,
                            "In file included from %s:%d",
-                          p->name, p->line);
+                          p->location.file, p->location.line);
        else
          output_verbatim (&context->buffer,
                            ",\n                 from %s:%d",
-                          p->name, p->line);
+                          p->location.file, p->location.line);
       output_verbatim (&context->buffer, ":\n");
       diagnostic_set_last_module (context);
     }
index acbb6280e2d427e7bb9965a50c64e0441407b274..3f12a91798ac94e61be6ce6726158b03af6e78e6 100644 (file)
@@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #define GCC_DIAGNOSTIC_H
 
 #include "obstack.h"
-#include "location.h"
+#include "input.h"
 
 /* The type of a text to be formatted according a format specification
    along with a list of things.  */
index a1c16a51d2e7021498cd212db7ae344188677f42..6a5bc804734bec7310318a99d48249c87fb543b8 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * lex.c (ffelex_file_pop_): Adjust file_stack member use.
+       (ffelex_file_push_): Likewise.
+       (ffelex_hash_): Likewise.
+
 2003-05-01  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ansify.c (die_unless): Rename lineno to input_line.
index f1e2e97cd55a40287b3c8fda8a69ff0ee7cb52db..abdea332cef3ceed492eca14595f24a577a5c29a 100644 (file)
@@ -796,7 +796,7 @@ ffelex_file_pop_ (const char *filename)
       input_file_stack = p->next;
       free (p);
       input_file_stack_tick++;
-      (*debug_hooks->end_source_file) (input_file_stack->line);
+      (*debug_hooks->end_source_file) (input_file_stack->location.line);
     }
   else
     error ("#-lines for entering and leaving files don't match");
@@ -804,7 +804,7 @@ ffelex_file_pop_ (const char *filename)
   /* Now that we've pushed or popped the input stack,
      update the name in the top element.  */
   if (input_file_stack)
-    input_file_stack->name = filename;
+    input_file_stack->location.file = filename;
 }
 
 static void
@@ -813,9 +813,9 @@ ffelex_file_push_ (int old_lineno, const char *filename)
   struct file_stack *p
     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
 
-  input_file_stack->line = old_lineno;
+  input_file_stack->location.line = old_lineno;
   p->next = input_file_stack;
-  p->name = filename;
+  p->location.file = filename;
   input_file_stack = p;
   input_file_stack_tick++;
 
@@ -824,7 +824,7 @@ ffelex_file_push_ (int old_lineno, const char *filename)
   /* Now that we've pushed or popped the input stack,
      update the name in the top element.  */
   if (input_file_stack)
-    input_file_stack->name = filename;
+    input_file_stack->location.file = filename;
 }
 
 /* Prepare to finish a statement-in-progress by sending the current
@@ -1260,7 +1260,7 @@ ffelex_hash_ (FILE *finput)
            {
              /* Update the name in the top element of input_file_stack.  */
              if (input_file_stack)
-               input_file_stack->name = input_filename;
+               input_file_stack->location.file = input_filename;
 
              if (token != NULL)
                ffelex_token_kill (token);
index 06691bd9f6b7e82e4246f7d29d32205c35900b21..e96a22089d6be0cdd96041125ff9074697f1df49 100644 (file)
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -1,5 +1,5 @@
 /* Header file for modules that link with gcc.c
-   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -57,8 +57,6 @@ struct spec_function
 extern int do_spec PARAMS ((const char *));
 extern void record_temp_file PARAMS ((const char *, int, int));
 extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
-extern const char *input_filename;
-extern size_t input_filename_length;
 extern void fatal PARAMS ((const char *, ...))
      ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 extern void error PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
index 0bc15dea45fbdfe40d01be2c462e7cd5f6f26073..6dd12521eefac2f6f32b10a1af9ba58742d23c65 100644 (file)
@@ -19,24 +19,32 @@ along with GCC; see the file COPYING.  If not, write to the Free
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
-/* Source file current line is coming from.  */
-extern const char *input_filename;
+#ifndef GCC_INPUT_H
+#define GCC_INPUT_H
 
-/* Top-level source file.  */
-extern const char *main_input_filename;
+/* The data structure used to record a location in a translation unit.  */
+struct location_s GTY (())
+{
+  /* The name of the source file involved.  */     
+  const char *file;
 
-/* Line number in current source file.  */
-extern int input_line;
-
-/* Stream for reading from input file.  */
-extern FILE *finput;
+  /* The line-location in the source file.  */
+  int line;
+};
+typedef struct location_s location_t;
 
 struct file_stack
-  {
-    const char *name;
-    struct file_stack *next;
-    int line;
-  };
+{
+  struct file_stack *next;
+  location_t location;
+};
+
+/* Top-level source file.  */
+extern const char *main_input_filename;
+
+extern location_t input_location;
+#define input_line (input_location.line)
+#define input_filename (input_location.file)
 
 /* Stack of currently pending input files.
    The line member is not accurate for the innermost file on the stack.  */
@@ -47,3 +55,5 @@ extern int input_file_stack_tick;
 
 extern void push_srcloc PARAMS ((const char *name, int line));
 extern void pop_srcloc PARAMS ((void));
+
+#endif
index 4dedd5d839d58946c879e718366f6edd0d665067..546e6790522562f468fa6772005b74ee3d144df7 100644 (file)
@@ -1,3 +1,11 @@
+2003-05-02  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * lex.h (input_lineno): Remove declaration.
+       * parse-scan.y: #include input.h.
+       (input_filename): Remove declaration.
+       (input_location): Add definition.
+       (input_line): Remove definition.
+
 2003-05-01  Nathan Sidwell  <nathan@codesourcery.com>
 
        * lex.h (lineno): Rename to ...
index 3c924e4e4a5ca34a4ec8cf68dfe1f77ec299201e..850ce6868ce9b3e62584bed39898255911003751 100644 (file)
@@ -29,7 +29,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 
 /* Extern global variables declarations  */
 extern FILE *finput;
-extern int   input_lineno;
 
 /* A Unicode character, as read from the input file  */
 typedef unsigned short unicode_t;
index 233a98707c4f8843087fd70f7b6dbe29d4fa937a..37d79d9240ba64c8f6f0836a6e2d263e5a9f8743 100644 (file)
@@ -41,12 +41,15 @@ definitions and other extensions.  */
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-
+#include "input.h"
 #include "obstack.h"
 #include "toplev.h"
 
-extern char *input_filename;
 extern FILE *finput, *out;
+/* Current position in real source file.  */
+
+location_t input_location;
 
 /* Obstack for the lexer.  */
 struct obstack temporary_obstack;
@@ -54,11 +57,9 @@ struct obstack temporary_obstack;
 /* The current parser context.  */
 static struct parser_ctxt *ctxp;
 
-/* Error and warning counts, current line number, because they're used
-   elsewhere  */
+/* Error and warning counts, because they're used elsewhere  */
 int java_error_count;
 int java_warning_count;
-int input_line;
 
 /* Tweak default rules when necessary.  */
 static int absorber;
diff --git a/gcc/location.h b/gcc/location.h
deleted file mode 100644 (file)
index 1864f29..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Definition of location data type used in various part of GCC
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
-
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them.   Help stamp out software-hoarding!  */
-
-#ifndef GCC_LOCATION_H
-#define GCC_LOCATION_H
-
-/* The data structure used to record a location in a translation unit.  */
-struct location_s GTY (())
-{
-  /* The name of the source file involved.  */     
-  const char *file;
-
-  /* The line-location in the source file.  */
-  int line;
-};
-typedef struct location_s location_t;
-
-#endif
-
index 0aee80f308aa98e2f0ccc607d64d773599952f47..fc25ca4f1d8beb662935c0085543f6609ef15c2d 100644 (file)
@@ -149,20 +149,15 @@ const char *progname;
 int save_argc;
 char **save_argv;
 \f
-/* Name of current original source file (what was input to cpp).
-   This comes from each #-command in the actual input.  */
-
-const char *input_filename;
-
 /* Name of top-level original source file (what was input to cpp).
    This comes from the #-command at the beginning of the actual input.
    If there isn't any there, then this is the cc1 input file name.  */
 
 const char *main_input_filename;
 
-/* Current line number in real source file.  */
+/* Current position in real source file.  */
 
-int input_line;
+location_t input_location;
 
 /* Nonzero if it is unsafe to create any new pseudo registers.  */
 int no_new_pseudos;
@@ -2147,14 +2142,12 @@ push_srcloc (file, line)
   struct file_stack *fs;
 
   if (input_file_stack)
-    {
-      input_file_stack->name = input_filename;
-      input_file_stack->line = input_line;
-    }
+    input_file_stack->location = input_location;
 
   fs = (struct file_stack *) xmalloc (sizeof (struct file_stack));
-  fs->name = input_filename = file;
-  fs->line = input_line = line;
+  input_filename = file;
+  input_line = line;
+  fs->location = input_location;
   fs->next = input_file_stack;
   input_file_stack = fs;
   input_file_stack_tick++;
@@ -2175,10 +2168,7 @@ pop_srcloc ()
   input_file_stack_tick++;
 
   if (input_file_stack)
-    {
-      input_filename = input_file_stack->name;
-      input_line = input_file_stack->line;
-    }
+    input_location = input_file_stack->location;
   else
     {
       input_filename = NULL;
index 791be350da7cb4f6ea340ecbd332a2dea52576cc..8c01ca169079a7975b46bce9b1ba18d5ed18de7a 100644 (file)
@@ -24,7 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include "machmode.h"
 #include "version.h"
-#include "location.h"
+#include "input.h"
 
 /* Codes of tree nodes */
 
@@ -2778,13 +2778,6 @@ extern int real_zerop PARAMS ((tree));
 \f
 /* Declare commonly used variables for tree structure.  */
 
-/* Points to the name of the input file from which the current input
-   being parsed originally came (before it went into cpp).  */
-extern const char *input_filename;
-
-/* Current line number in input file.  */
-extern int input_line;
-
 /* Nonzero means lvalues are limited to those valid in pedantic ANSI C.
    Zero means allow extended lvalues.  */