input.c: New file.
* 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. From-SVN: r159914
This commit is contained in:
parent
62116e601b
commit
447924ef3b
7 changed files with 70 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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 \
|
||||
|
|
53
gcc/input.c
Normal file
53
gcc/input.c
Normal file
|
@ -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;
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
22
gcc/tree.c
22
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.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue