OSDN Git Service

* input.c: New file.
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 May 2010 11:33:27 +0000 (11:33 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 May 2010 11:33:27 +0000 (11:33 +0000)
* input.h (main_input_filename): Move declaration to toplev.h.
* toplev.c (input_location, line_table): Move to input.c
* toplev.h (main_input_filename): Move declaration from input.h.
* tree.c (expand_location): Move to input.c.
* Makefile.in (OBJS-common): Add input.o.
(input.o): Add dependencies.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159914 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/input.c [new file with mode: 0644]
gcc/input.h
gcc/toplev.c
gcc/toplev.h
gcc/tree.c

index 027c810..9875849 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-27  Joseph Myers  <joseph@codesourcery.com>
+
+       * input.c: New file.
+       * input.h (main_input_filename): Move declaration to toplev.h.
+       * toplev.c (input_location, line_table): Move to input.c
+       * toplev.h (main_input_filename): Move declaration from input.h.
+       * tree.c (expand_location): Move to input.c.
+       * Makefile.in (OBJS-common): Add input.o.
+       (input.o): Add dependencies.
+
 2010-05-27  Richard Guenther  <rguenther@suse.de>
 
        * lto-wrapper.c (maybe_unlink_file): Ignore unlink failure
index 77b836f..42b8a88 100644 (file)
@@ -1233,6 +1233,7 @@ OBJS-common = \
        ifcvt.o \
        implicit-zee.o \
        init-regs.o \
+       input.o \
        integrate.o \
        intl.o \
        ira.o \
@@ -2756,6 +2757,8 @@ s-bversion: BASE-VER
        echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> bversion.h
        $(STAMP) s-bversion
 
+input.o : input.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(INPUT_H)
+
 toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
    $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
diff --git a/gcc/input.c b/gcc/input.c
new file mode 100644 (file)
index 0000000..e5e051f
--- /dev/null
@@ -0,0 +1,53 @@
+/* Data and functions related to line maps and input files.
+   Copyright (C) 2004, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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 3, or (at your option) any later
+version.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "intl.h"
+#include "input.h"
+
+/* Current position in real source file.  */
+
+location_t input_location;
+
+struct line_maps *line_table;
+
+expanded_location
+expand_location (source_location loc)
+{
+  expanded_location xloc;
+  if (loc <= BUILTINS_LOCATION)
+    {
+      xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>");
+      xloc.line = 0;
+      xloc.column = 0;
+      xloc.sysp = 0;
+    }
+  else
+    {
+      const struct line_map *map = linemap_lookup (line_table, loc);
+      xloc.file = map->to_file;
+      xloc.line = SOURCE_LINE (map, loc);
+      xloc.column = SOURCE_COLUMN (map, loc);
+      xloc.sysp = map->sysp != 0;
+    };
+  return xloc;
+}
index 7f00dc7..399a685 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations for variables relating to reading the source file.
    Used by parsers, lexical analyzers, and error message routines.
-   Copyright (C) 1993, 1997, 1998, 2000, 2003, 2004, 2007, 2008, 2009
+   Copyright (C) 1993, 1997, 1998, 2000, 2003, 2004, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -57,9 +57,6 @@ extern expanded_location expand_location (source_location);
    This could be removed but it hardly seems worth the effort.  */
 typedef source_location location_t;
 
-/* Top-level source file.  */
-extern const char *main_input_filename;
-
 extern location_t input_location;
 
 #define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
index f22c4d5..a5e6203 100644 (file)
@@ -143,12 +143,6 @@ const char *main_input_filename;
    to optimize in process_options ().  */
 #define AUTODETECT_VALUE 2
 
-/* Current position in real source file.  */
-
-location_t input_location;
-
-struct line_maps *line_table;
-
 /* Name to use as base of names for dump output files.  */
 
 const char *dump_base_name;
index 2b2a291..033c6dc 100644 (file)
@@ -119,6 +119,9 @@ extern void target_reinit (void);
 /* A unique local time stamp, might be zero if none is available.  */
 extern unsigned local_tick;
 
+/* Top-level source file.  */
+extern const char *main_input_filename;
+
 extern const char *progname;
 extern const char *dump_base_name;
 extern const char *dump_dir_name;
index 4bef134..743293e 100644 (file)
@@ -3950,28 +3950,6 @@ build_block (tree vars, tree subblocks, tree supercontext, tree chain)
   return block;
 }
 
-expanded_location
-expand_location (source_location loc)
-{
-  expanded_location xloc;
-  if (loc <= BUILTINS_LOCATION)
-    {
-      xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>");
-      xloc.line = 0;
-      xloc.column = 0;
-      xloc.sysp = 0;
-    }
-  else
-    {
-      const struct line_map *map = linemap_lookup (line_table, loc);
-      xloc.file = map->to_file;
-      xloc.line = SOURCE_LINE (map, loc);
-      xloc.column = SOURCE_COLUMN (map, loc);
-      xloc.sysp = map->sysp != 0;
-    };
-  return xloc;
-}
-
 \f
 /* Like SET_EXPR_LOCATION, but make sure the tree can have a location.