aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@codesourcery.com>2002-07-10 10:36:27 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2002-07-10 10:36:27 +0000
commite6986399dce0b228feb187326e67f08c8008e37c (patch)
tree798555e0df33e387c50ea2b5cb4819e17982e2e8 /gcc
parent99248579810c9a0dba0daaf12d4a04892b9f52e9 (diff)
downloadgcc-e6986399dce0b228feb187326e67f08c8008e37c.zip
gcc-e6986399dce0b228feb187326e67f08c8008e37c.tar.gz
gcc-e6986399dce0b228feb187326e67f08c8008e37c.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/Makefile.in7
-rw-r--r--gcc/diagnostic.h11
-rw-r--r--gcc/location.h38
-rw-r--r--gcc/tree.h9
5 files changed, 62 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47805c9..7a4e958 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d1af43c..e1e5a61 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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)
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index c98b8e1..c4238df 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -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. */
diff --git a/gcc/location.h b/gcc/location.h
new file mode 100644
index 0000000..1864f29
--- /dev/null
+++ b/gcc/location.h
@@ -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
+
diff --git a/gcc/tree.h b/gcc/tree.h
index 795abeb..84a2218 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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;