This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[incremental] Patch: FYI: update all lang_identifier structs
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 29 Nov 2007 12:17:14 -0700
- Subject: [incremental] Patch: FYI: update all lang_identifier structs
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in on the incremental-compiler branch.
This is a followup to the earlier patches to allow garbage collection
of identifiers. This patch makes it possible to build all the non-C
front ends, by fixing lang_identifier (or in ada's case, adding one).
I haven't tested the other front ends yet.
Tom
java/ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* java-tree.h (struct lang_identifier) <id>: New field.
* expr.c: Include langhooks.h.
* mangle.c: Include langhooks.h.
* verify-glue.c: Include langhooks.h.
* except.c: Include langhooks.h.
* resource.c: Include langhooks.h.
* constants.c: Include langhooks.h.
* jcf-parse.c: Include langhooks.h.
* class.c: Include langhooks.h.
* typeck.c: Include langhooks.h.
ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* c-decl.c (struct lang_identifier): Add comment for 'node'
field.
cp/ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* parser.c: Include langhooks.h.
* decl2.c: Include langhooks.h.
* lex.c: Include langhooks.h.
* name-lookup.c: Include langhooks.h.
* semantics.c: Include langhooks.h.
* pt.c: Include langhooks.h.
* cp-lang.c (LANG_HOOKS_IDENTIFIER_OFFSET): New define.
* cxx-pretty-print.c: Include langhooks.h.
* cp-tree.h (struct lang_identifier) <node>: New field.
* mangle.c: Include langhooks.h.
* tree.c: Include langhooks.h.
* error.c: Include langhooks.h.
* except.c: Include langhooks.h.
* method.c: Include langhooks.h.
* repo.c: Include langhooks.h.
* class.c: Include langhooks.h.
* typeck.c: Include langhooks.h.
ada/ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* utils2.c: Include langhooks.h.
* decl.c: Include langhooks.h.
* misc.c (LANG_HOOKS_IDENTIFIER_SIZE): Remove.
* utils.c: Include langhooks.h.
* ada-tree.h (struct lang_identifier): New struct.
(union lang_tree_node) <identifier>: New field.
* trans.c: Include langhooks.h.
fortran/ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* trans-decl.c: Include langhooks.h.
* iresolve.c: Include langhooks.h.
* f95-lang.c (struct lang_identifier) <id>: New field.
treelang/ChangeLog:
2007-11-29 Tom Tromey <tromey@redhat.com>
* treetree.c (struct lang_identifier) <id>: New field.
Index: java/typeck.c
===================================================================
--- java/typeck.c (revision 130053)
+++ java/typeck.c (working copy)
@@ -37,6 +37,7 @@
#include "convert.h"
#include "toplev.h"
#include "ggc.h"
+#include "langhooks.h"
static tree convert_ieee_real_to_integer (tree, tree);
static tree parse_signature_type (const unsigned char **,
Index: java/class.c
===================================================================
--- java/class.c (revision 130053)
+++ java/class.c (working copy)
@@ -46,6 +46,7 @@
#include "tree-iterator.h"
#include "cgraph.h"
#include "vecprim.h"
+#include "langhooks.h"
/* DOS brain-damage */
#ifndef O_BINARY
Index: java/jcf-parse.c
===================================================================
--- java/jcf-parse.c (revision 130053)
+++ java/jcf-parse.c (working copy)
@@ -44,6 +44,7 @@
#include "tm_p.h"
#include "cgraph.h"
#include "vecprim.h"
+#include "langhooks.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
Index: java/constants.c
===================================================================
--- java/constants.c (revision 130053)
+++ java/constants.c (working copy)
@@ -30,6 +30,7 @@
#include "java-tree.h"
#include "toplev.h"
#include "ggc.h"
+#include "langhooks.h"
static void set_constant_entry (CPool *, int, int, jword);
static int find_tree_constant (CPool *, int, tree);
Index: java/resource.c
===================================================================
--- java/resource.c (revision 130053)
+++ java/resource.c (working copy)
@@ -42,6 +42,7 @@
#include "expr.h"
#include "tree-iterator.h"
#include "cgraph.h"
+#include "langhooks.h"
/* DOS brain-damage */
#ifndef O_BINARY
Index: java/except.c
===================================================================
--- java/except.c (revision 130053)
+++ java/except.c (working copy)
@@ -37,6 +37,7 @@
#include "except.h"
#include "java-except.h"
#include "toplev.h"
+#include "langhooks.h"
static void expand_start_java_handler (struct eh_range *);
static struct eh_range *find_handler_in_range (int, struct eh_range *,
Index: java/verify-glue.c
===================================================================
--- java/verify-glue.c (revision 130053)
+++ java/verify-glue.c (working copy)
@@ -35,6 +35,7 @@
#include "java-tree.h"
#include "java-except.h"
#include "toplev.h"
+#include "langhooks.h"
void *
vfy_alloc (size_t bytes)
Index: java/mangle.c
===================================================================
--- java/mangle.c (revision 130053)
+++ java/mangle.c (working copy)
@@ -36,6 +36,7 @@
#include "toplev.h"
#include "ggc.h"
#include "langhooks-def.h"
+#include "langhooks.h"
static void mangle_class_field (tree);
static void mangle_vtable (tree);
Index: java/expr.c
===================================================================
--- java/expr.c (revision 130053)
+++ java/expr.c (working copy)
@@ -44,6 +44,7 @@
#include "ggc.h"
#include "tree-gimple.h"
#include "target.h"
+#include "langhooks.h"
static void flush_quick_stack (void);
static void push_value (tree);
Index: java/java-tree.h
===================================================================
--- java/java-tree.h (revision 130053)
+++ java/java-tree.h (working copy)
@@ -653,6 +653,9 @@
/* If non-NULL: An ADDR_REF to a VAR_DECL that contains
* the Utf8Const representation of the identifier. */
tree utf8_ref;
+
+ /* The identifier allocation code requires this field to be last. */
+ struct ht_identifier id;
};
/* The resulting tree type. */
Index: cp/typeck.c
===================================================================
--- cp/typeck.c (revision 130053)
+++ cp/typeck.c (working copy)
@@ -44,6 +44,7 @@
#include "convert.h"
#include "c-common.h"
#include "params.h"
+#include "langhooks.h"
static tree pfn_from_ptrmemfunc (tree);
static tree convert_for_assignment (tree, tree, const char *, tree, int);
Index: cp/class.c
===================================================================
--- cp/class.c (revision 130053)
+++ cp/class.c (working copy)
@@ -37,6 +37,7 @@
#include "convert.h"
#include "cgraph.h"
#include "tree-dump.h"
+#include "langhooks.h"
/* The number of nested classes being processed. If we are not in the
scope of any class, this is zero. */
Index: cp/repo.c
===================================================================
--- cp/repo.c (revision 130053)
+++ cp/repo.c (working copy)
@@ -36,6 +36,7 @@
#include "toplev.h"
#include "diagnostic.h"
#include "flags.h"
+#include "langhooks.h"
static char *extract_string (char **);
static const char *get_base_filename (const char *);
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 130053)
+++ cp/decl.c (working copy)
@@ -52,6 +52,7 @@
#include "timevar.h"
#include "tree-flow.h"
#include "pointer-set.h"
+#include "langhooks.h"
static tree grokparms (cp_parameter_declarator *, tree *);
static const char *redeclaration_error_message (tree, tree);
Index: cp/method.c
===================================================================
--- cp/method.c (revision 130053)
+++ cp/method.c (working copy)
@@ -38,6 +38,7 @@
#include "target.h"
#include "tree-pass.h"
#include "diagnostic.h"
+#include "langhooks.h"
/* Various flags to control the mangling process. */
Index: cp/except.c
===================================================================
--- cp/except.c (revision 130053)
+++ cp/except.c (working copy)
@@ -38,6 +38,7 @@
#include "tree-inline.h"
#include "tree-iterator.h"
#include "target.h"
+#include "langhooks.h"
static void push_eh_cleanup (tree);
static tree prepare_eh_type (tree);
Index: cp/error.c
===================================================================
--- cp/error.c (revision 130053)
+++ cp/error.c (working copy)
@@ -30,6 +30,7 @@
#include "diagnostic.h"
#include "langhooks-def.h"
#include "cxx-pretty-print.h"
+#include "langhooks.h"
#define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',')
Index: cp/tree.c
===================================================================
--- cp/tree.c (revision 130053)
+++ cp/tree.c (working copy)
@@ -36,6 +36,7 @@
#include "debug.h"
#include "target.h"
#include "convert.h"
+#include "langhooks.h"
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
Index: cp/mangle.c
===================================================================
--- cp/mangle.c (revision 130053)
+++ cp/mangle.c (working copy)
@@ -58,6 +58,7 @@
#include "varray.h"
#include "flags.h"
#include "target.h"
+#include "langhooks.h"
/* Debugging support. */
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h (revision 130053)
+++ cp/cp-tree.h (working copy)
@@ -208,6 +208,9 @@
cxx_binding *bindings;
tree class_template_info;
tree label_value;
+ /* This must be last, as we use the struct hack to store the
+ identifier characters at the end of the object. */
+ struct cpp_hashnode node;
};
/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
Index: cp/cxx-pretty-print.c
===================================================================
--- cp/cxx-pretty-print.c (revision 130053)
+++ cp/cxx-pretty-print.c (working copy)
@@ -26,6 +26,7 @@
#include "cxx-pretty-print.h"
#include "cp-tree.h"
#include "toplev.h"
+#include "langhooks.h"
static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
Index: cp/cp-lang.c
===================================================================
--- cp/cp-lang.c (revision 130053)
+++ cp/cp-lang.c (working copy)
@@ -55,6 +55,10 @@
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS cp_init_ts
+#undef LANG_HOOKS_IDENTIFIER_OFFSET
+#define LANG_HOOKS_IDENTIFIER_OFFSET \
+ offsetof (struct lang_identifier, node.ident)
+
/* Each front end provides its own lang hook initializer. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 130053)
+++ cp/pt.c (working copy)
@@ -45,6 +45,7 @@
#include "timevar.h"
#include "tree-iterator.h"
#include "vecprim.h"
+#include "langhooks.h"
/* The type of functions taking a tree, and some additional data, and
returning an int. */
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 130053)
+++ cp/semantics.c (working copy)
@@ -46,6 +46,7 @@
#include "tree-iterator.h"
#include "vec.h"
#include "target.h"
+#include "langhooks.h"
/* There routines provide a modular interface to perform many parsing
operations. They may therefore be used during actual parsing, or
Index: cp/name-lookup.c
===================================================================
--- cp/name-lookup.c (revision 130053)
+++ cp/name-lookup.c (working copy)
@@ -32,6 +32,7 @@
#include "diagnostic.h"
#include "debug.h"
#include "c-pragma.h"
+#include "langhooks.h"
/* The bindings for a particular name in a particular scope. */
Index: cp/lex.c
===================================================================
--- cp/lex.c (revision 130053)
+++ cp/lex.c (working copy)
@@ -37,6 +37,7 @@
#include "output.h"
#include "tm_p.h"
#include "timevar.h"
+#include "langhooks.h"
static int interface_strcmp (const char *);
static void init_cp_pragma (void);
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 130053)
+++ cp/decl2.c (working copy)
@@ -50,6 +50,7 @@
#include "c-pragma.h"
#include "tree-dump.h"
#include "intl.h"
+#include "langhooks.h"
extern cpp_reader *parse_in;
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 130053)
+++ cp/parser.c (working copy)
@@ -37,6 +37,7 @@
#include "target.h"
#include "cgraph.h"
#include "c-common.h"
+#include "langhooks.h"
/* The lexer. */
Index: ada/trans.c
===================================================================
--- ada/trans.c (revision 130053)
+++ ada/trans.c (working copy)
@@ -56,6 +56,7 @@
#include "einfo.h"
#include "ada-tree.h"
#include "gigi.h"
+#include "langhooks.h"
/* Let code below know whether we are targetting VMS without need of
intrusive preprocessor directives. */
Index: ada/ada-tree.h
===================================================================
--- ada/ada-tree.h (revision 130053)
+++ ada/ada-tree.h (working copy)
@@ -33,12 +33,21 @@
};
#undef DEFTREECODE
+struct lang_identifier GTY(())
+{
+ struct tree_identifier common;
+
+ /* The identifier allocation code requires this field to be last. */
+ struct ht_identifier id;
+};
+
/* Ada uses the lang_decl and lang_type fields to hold a tree. */
union lang_tree_node
- GTY((desc ("0"),
+ GTY((desc ("TREE_CODE (&%h.t) == IDENTIFIER_NODE"),
chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.t)")))
{
union tree_node GTY((tag ("0"))) t;
+ struct lang_identifier GTY((tag ("1"))) identifier;
};
struct lang_decl GTY(()) {tree t; };
struct lang_type GTY(()) {tree t; };
Index: ada/utils.c
===================================================================
--- ada/utils.c (revision 130053)
+++ ada/utils.c (working copy)
@@ -43,6 +43,7 @@
#include "tree-gimple.h"
#include "tree-dump.h"
#include "pointer-set.h"
+#include "langhooks.h"
#include "ada.h"
#include "types.h"
Index: ada/misc.c
===================================================================
--- ada/misc.c (revision 130053)
+++ ada/misc.c (working copy)
@@ -109,8 +109,6 @@
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU Ada"
-#undef LANG_HOOKS_IDENTIFIER_SIZE
-#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier)
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT gnat_init
#undef LANG_HOOKS_INIT_OPTIONS
Index: ada/decl.c
===================================================================
--- ada/decl.c (revision 130053)
+++ ada/decl.c (working copy)
@@ -36,6 +36,7 @@
#include "obstack.h"
#include "target.h"
#include "expr.h"
+#include "langhooks.h"
#include "ada.h"
#include "types.h"
Index: ada/utils2.c
===================================================================
--- ada/utils2.c (revision 130053)
+++ ada/utils2.c (working copy)
@@ -46,6 +46,7 @@
#include "einfo.h"
#include "ada-tree.h"
#include "gigi.h"
+#include "langhooks.h"
static tree find_common_type (tree, tree);
static bool contains_save_expr_p (tree);
Index: c-decl.c
===================================================================
--- c-decl.c (revision 130506)
+++ c-decl.c (working copy)
@@ -241,6 +241,9 @@
struct c_binding *symbol_binding; /* vars, funcs, constants, typedefs */
struct c_binding *tag_binding; /* struct/union/enum tags */
struct c_binding *label_binding; /* labels */
+
+ /* This must be last, as we use the struct hack to store the
+ identifier characters at the end of the object. */
struct cpp_hashnode node;
};
Index: fortran/f95-lang.c
===================================================================
--- fortran/f95-lang.c (revision 130053)
+++ fortran/f95-lang.c (working copy)
@@ -55,6 +55,9 @@
GTY(())
{
struct tree_identifier common;
+
+ /* The identifier allocation code requires this field to be last. */
+ struct ht_identifier id;
};
/* The resulting tree type. */
Index: fortran/iresolve.c
===================================================================
--- fortran/iresolve.c (revision 130053)
+++ fortran/iresolve.c (working copy)
@@ -33,6 +33,7 @@
#include "tree.h"
#include "gfortran.h"
#include "intrinsic.h"
+#include "langhooks.h"
/* Given printf-like arguments, return a stable version of the result string.
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c (revision 130053)
+++ fortran/trans-decl.c (working copy)
@@ -42,6 +42,7 @@
#include "trans-const.h"
/* Only for gfc_trans_code. Shouldn't need to include this. */
#include "trans-stmt.h"
+#include "langhooks.h"
#define MAX_LABEL_VALUE 99999
Index: treelang/treetree.c
===================================================================
--- treelang/treetree.c (revision 130053)
+++ treelang/treetree.c (working copy)
@@ -92,6 +92,9 @@
struct lang_identifier GTY(())
{
struct tree_identifier common;
+
+ /* The identifier allocation code requires this field to be last. */
+ struct ht_identifier id;
};
/* Language-specific tree node information. */