diagnostic.h: #include location.h
authorGabriel Dos Reis <gdr@codesourcery.com>
Wed, 10 Jul 2002 10:36:27 +0000 (10:36 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Wed, 10 Jul 2002 10:36:27 +0000 (10:36 +0000)
* 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

gcc/ChangeLog
gcc/Makefile.in
gcc/diagnostic.h
gcc/location.h [new file with mode: 0644]
gcc/tree.h

index 47805c96fcde6fa583d50b6ea52e907f2b486419..7a4e95896acb67a41cf486c635cf29092e64d15a 100644 (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
index d1af43cdcf2a06839c473ba8b6b5fa5f2e80b8c0..e1e5a61873599c2f212e6b4c062fdffd39c71988 100644 (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)
index c98b8e13b6e4e9684963eee4791ffe120682f6f5..c4238df6abacf8e396e9d2cbdc8118129d84f69e 100644 (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.  */
diff --git a/gcc/location.h b/gcc/location.h
new file mode 100644 (file)
index 0000000..1864f29
--- /dev/null
@@ -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
+
index 795abebfef22dba0f4897f0efef2ef0f4a57e23f..84a221822aac0adb522a86d58a4da59b5f6f2622 100644 (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;