diagnostic.h: #include location.h

* diagnostic.h: #include location.h
	(location_t): Move definition to..
	* location.h: ... here.  New file.
	* tree.h: #include location.h
	(DECL_SOURCE_LOCATION): New macro.
	(DECL_SOURCE_FILE): Use.
	(DECL_SOURCE_LINE): Likewise.
	(struct tree_decl): REplace filename and linenum with locus.
	* Makefile.in (TREE_H): add location.h
	(diagnostic.o): Depends on gt-location.h
	(gt-location.h): Depends on s-gtype

From-SVN: r55364
This commit is contained in:
Gabriel Dos Reis 2002-07-10 10:36:27 +00:00 committed by Gabriel Dos Reis
parent 9924857981
commit e6986399dc
5 changed files with 62 additions and 17 deletions

View File

@ -1,3 +1,17 @@
2002-07-09 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.h: #include location.h
(location_t): Move definition to..
* location.h: ... here. New file.
* tree.h: #include location.h
(DECL_SOURCE_LOCATION): New macro.
(DECL_SOURCE_FILE): Use.
(DECL_SOURCE_LINE): Likewise.
(struct tree_decl): REplace filename and linenum with locus.
* Makefile.in (TREE_H): add location.h
(diagnostic.o): Depends on gt-location.h
(gt-location.h): Depends on s-gtype
2002-07-09 Matt Kraai <kraai@alumni.cmu.edu>
* config/rs6000/aix.h: Convert CPP_PREDEFINES to

View File

@ -553,7 +553,8 @@ MACHMODE_H = machmode.h machmode.def @extra_modes_file@
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
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h version.h builtins.def \
location.h
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h
DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
@ -1807,7 +1808,7 @@ s-preds: genpreds$(build_exeext) $(srcdir)/move-if-change
$(SHELL) $(srcdir)/move-if-change tmp-preds.h tm-preds.h
$(STAMP) s-preds
GTFILES = $(GCONFIG_H) \
GTFILES = $(GCONFIG_H) $(srcdir)/location.h \
$(HASHTAB_H) \
$(srcdir)/bitmap.h $(srcdir)/function.h $(srcdir)/rtl.h $(srcdir)/optabs.h \
$(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h $(srcdir)/real.h \
@ -1834,7 +1835,7 @@ gt-alias.h gt-cselib.h gt-fold-const.h gt-gcse.h gt-profile.h : s-gtype; @true
gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dwarf2out.h : s-gtype ; @true
gt-reg-stack.h gt-dependence.h : s-gtype ; @true
gt-c-common.h gt-c-decl.h gt-c-parse.h gt-c-pragma.h : s-gtype; @true
gt-c-objc-common.h gtype-c.h : s-gtype ; @true
gt-c-objc-common.h gtype-c.h gt-location.h : s-gtype ; @true
s-gtype: gengtype$(build_exeext) $(GTFILES)
./gengtype $(GTFILES)

View File

@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define GCC_DIAGNOSTIC_H
#include "obstack.h"
#include "location.h"
/* The type of a text to be formatted according a format specification
along with a list of things. */
@ -41,16 +42,6 @@ typedef enum
DK_LAST_DIAGNOSTIC_KIND
} diagnostic_t;
/* The data structure used to record the location of a diagnostic. */
typedef struct
{
/* The name of the source file involved in the diagnostic. */
const char *file;
/* The line-location in the source file. */
int line;
} location_t;
/* A diagnostic is described by the MESSAGE to send, the FILE and LINE of
its context and its KIND (ice, error, warning, note, ...) See complete
list in diagnostic.def. */

38
gcc/location.h Normal file
View File

@ -0,0 +1,38 @@
/* 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

View File

@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "machmode.h"
#include "version.h"
#include "location.h"
/* Codes of tree nodes */
@ -1449,8 +1450,9 @@ struct tree_type GTY(())
was. If the declaration appears in several places (as for a C
function that is declared first and then defined later), this
information should refer to the definition. */
#define DECL_SOURCE_FILE(NODE) (DECL_CHECK (NODE)->decl.filename)
#define DECL_SOURCE_LINE(NODE) (DECL_CHECK (NODE)->decl.linenum)
#define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus)
#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file)
#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line)
/* Holds the size of the datum, in bits, as a tree expression.
Need not be constant. */
#define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)
@ -1770,8 +1772,7 @@ struct function;
struct tree_decl GTY(())
{
struct tree_common common;
const char *filename;
int linenum;
location_t locus;
unsigned int uid;
tree size;
ENUM_BITFIELD(machine_mode) mode : 8;