aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/Makefile.in3
-rw-r--r--gcc/input.c53
-rw-r--r--gcc/input.h5
-rw-r--r--gcc/toplev.c6
-rw-r--r--gcc/toplev.h3
-rw-r--r--gcc/tree.c22
7 files changed, 70 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 027c810..9875849 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 77b836f..42b8a88 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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
index 0000000..e5e051f
--- /dev/null
+++ b/gcc/input.c
@@ -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;
+}
diff --git a/gcc/input.h b/gcc/input.h
index 7f00dc7..399a685 100644
--- a/gcc/input.h
+++ b/gcc/input.h
@@ -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)
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f22c4d5..a5e620387 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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;
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 2b2a291..033c6dc 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -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;
diff --git a/gcc/tree.c b/gcc/tree.c
index 4bef134..743293e 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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;
-}
-
/* Like SET_EXPR_LOCATION, but make sure the tree can have a location.