Commit 6060edcb by Nathan Sidwell Committed by Nathan Sidwell

Makefile.in (TREE_H): Replace location.h with input.h.

	* 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
parent ce61bf7b
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
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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. */
......
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.
......
......@@ -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);
......
/* 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;
......
......@@ -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
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 ...
......
......@@ -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;
......
......@@ -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;
......
/* 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
......@@ -149,20 +149,15 @@ const char *progname;
int save_argc;
char **save_argv;
/* 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;
......
......@@ -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));
/* 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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment