From: ghazi Date: Wed, 13 Mar 2002 01:42:43 +0000 (+0000) Subject: * c-common.c (c_tree_code_type, c_tree_code_length, X-Git-Tag: upstream/4.9.2~88092 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab1a776d37a0cdc57aed410ec50097abf3c42a48;p=platform%2Fupstream%2Flinaro-gcc.git * c-common.c (c_tree_code_type, c_tree_code_length, c_tree_code_name, add_c_tree_codes): Delete. * c-common.h (add_c_tree_codes): Delete. * c-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * c-objc-common.c (c_objc_common_init): Don't call add_c_tree_codes, instead set lang_unsafe_for_reeval. * objc/objc-act.c (objc_tree_code_type, objc_tree_code_length, objc_tree_code_name, add_objc_tree_codes): Delete. (objc_init): Don't call add_objc_tree_codes. * objc/objc-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * toplev.c (lang_independent_init): Don't set tree_code_length[IDENTIFIER_NODE]. * tree.c (tree_code_type, tree_code_length, tree_code_name): Delete definitions, moved to language front-ends. * tree.def (IDENTIFIER_NODE): Hardwire the length. * tree.h (tree_code_type, tree_code_length, tree_code_name): Const-ify. (tree_code_length): Change type to unsigned char. ada: * misc.c (gnat_tree_code_type, gnat_tree_code_length, gnat_tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (gnat_init): Don't try to copy into the various tree_code arrays. ch: * decl.c (chill_tree_code_type, chill_tree_code_length, chill_tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (init_decl_processing): Don't try to copy into the various tree_code arrays. cp: * cp-lang.c (tree_code_type, tree_code_length, tree_code_name): Define. * decl.c (duplicate_decls): Use TREE_CODE_LENGTH, not tree_code_length. * lex.c (cplus_tree_code_type, cplus_tree_code_length, cplus_tree_code_name): Delete. (cxx_init): Don't call add_c_tree_codes, instead set lang_unsafe_for_reeval. Don't try to copy into the various tree_code arrays. f: * com.c (tree_code_type, tree_code_length, tree_code_name): Define. java: * lang.c (java_tree_code_type, java_tree_code_length, tree_code_name): Delete. (tree_code_type, tree_code_length, tree_code_name): Define. (java_init): Don't try to copy into the various tree_code arrays. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50705 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba11d1a..48d9949 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2002-03-12 Kaveh R. Ghazi + + * c-common.c (c_tree_code_type, c_tree_code_length, + c_tree_code_name, add_c_tree_codes): Delete. + * c-common.h (add_c_tree_codes): Delete. + * c-lang.c (tree_code_type, tree_code_length, tree_code_name): + Define. + * c-objc-common.c (c_objc_common_init): Don't call + add_c_tree_codes, instead set lang_unsafe_for_reeval. + * objc/objc-act.c (objc_tree_code_type, objc_tree_code_length, + objc_tree_code_name, add_objc_tree_codes): Delete. + (objc_init): Don't call add_objc_tree_codes. + * objc/objc-lang.c (tree_code_type, tree_code_length, + tree_code_name): Define. + * toplev.c (lang_independent_init): Don't set + tree_code_length[IDENTIFIER_NODE]. + * tree.c (tree_code_type, tree_code_length, tree_code_name): + Delete definitions, moved to language front-ends. + * tree.def (IDENTIFIER_NODE): Hardwire the length. + * tree.h (tree_code_type, tree_code_length, tree_code_name): + Const-ify. + (tree_code_length): Change type to unsigned char. + 2002-03-12 Richard Henderson * config/i386/i386.c (ix86_expand_prologue): Revert 2002-03-03 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e524ac7..c149588 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2002-03-12 Kaveh R. Ghazi + + * misc.c (gnat_tree_code_type, gnat_tree_code_length, + gnat_tree_code_name): Delete. + (tree_code_type, tree_code_length, tree_code_name): Define. + (gnat_init): Don't try to copy into the various tree_code + arrays. + 2002-03-11 Richard Henderson * Makefile.in (.NOTPARALLEL): Add fake tag. diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 99e06fe..bd4ec73 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * $Revision$ + * $Revision: 1.20 $ * * * Copyright (C) 1992-2002 Free Software Foundation, Inc. * * * @@ -77,42 +77,6 @@ extern FILE *asm_out_file; extern int save_argc; extern char **save_argv; -/* Tables describing GCC tree codes used only by GNAT. - - Table indexed by tree code giving a string containing a character - classifying the tree code. Possibilities are - t, d, s, c, r, <, 1 and 2. See cp-tree.def for details. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -static const char gnat_tree_code_type[] = { - 'x', -#include "ada-tree.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -static const int gnat_tree_code_length[] = { - 0, -#include "ada-tree.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -const char * const gnat_tree_code_name[] = { - "@@dummy", -#include "ada-tree.def" -}; -#undef DEFTREECODE - static const char *gnat_init PARAMS ((const char *)); static void gnat_init_options PARAMS ((void)); static int gnat_decode_option PARAMS ((int, char **)); @@ -146,6 +110,45 @@ static int gnat_eh_type_covers PARAMS ((tree, tree)); const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +/* Tables describing GCC tree codes used only by GNAT. + + Table indexed by tree code giving a string containing a character + classifying the tree code. Possibilities are + t, d, s, c, r, <, 1 and 2. See cp-tree.def for details. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const char tree_code_type[] = { +#include "tree.def" + 'x', +#include "ada-tree.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" + 0, +#include "ada-tree.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char *const tree_code_name[] = { +#include "tree.def" + "@@dummy", +#include "ada-tree.def" +}; +#undef DEFTREECODE + /* gnat standard argc argv */ extern int gnat_argc; @@ -358,21 +361,6 @@ gnat_init (filename) lang_expand_expr = gnat_expand_expr; decl_printable_name = gnat_printable_name; - memcpy ((char *) (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE), - (char *) gnat_tree_code_type, - ((LAST_GNAT_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (char *))); - - memcpy ((char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE), - (char *) gnat_tree_code_length, - ((LAST_GNAT_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (int))); - - memcpy ((char *) (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE), - (char *) gnat_tree_code_name, - ((LAST_GNAT_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (char *))); - gnat_init_decl_processing (); /* Add the input filename as the last argument. */ diff --git a/gcc/c-common.c b/gcc/c-common.c index 7fad4b3..0352eb6 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3696,56 +3696,6 @@ c_staticp (exp) return 0; } -/* Tree code classes. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -static const char c_tree_code_type[] = { - 'x', -#include "c-common.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -static const int c_tree_code_length[] = { - 0, -#include "c-common.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -static const char *const c_tree_code_name[] = { - "@@dummy", -#include "c-common.def" -}; -#undef DEFTREECODE - -/* Adds the tree codes specific to the C front end to the list of all - tree codes. */ - -void -add_c_tree_codes () -{ - memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE, - c_tree_code_type, - (int) LAST_C_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE); - memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE, - c_tree_code_length, - (LAST_C_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) * sizeof (int)); - memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE, - c_tree_code_name, - (LAST_C_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) * sizeof (char *)); - lang_unsafe_for_reeval = c_unsafe_for_reeval; -} - #define CALLED_AS_BUILT_IN(NODE) \ (!strncmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__builtin_", 10)) diff --git a/gcc/c-common.h b/gcc/c-common.h index a7581df..314a6ba 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -728,7 +728,6 @@ enum c_tree_code { #undef DEFTREECODE -extern void add_c_tree_codes PARAMS ((void)); extern void genrtl_do_pushlevel PARAMS ((void)); extern void genrtl_goto_stmt PARAMS ((tree)); extern void genrtl_expr_stmt PARAMS ((tree)); diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 174f9dc..c01d256 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -73,6 +73,41 @@ static void c_post_options PARAMS ((void)); /* Each front end provides its own. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +/* Tree code classes. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const char tree_code_type[] = { +#include "tree.def" + 'x', +#include "c-common.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" + 0, +#include "c-common.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char *const tree_code_name[] = { +#include "tree.def" + "@@dummy", +#include "c-common.def" +}; +#undef DEFTREECODE + /* Post-switch processing. */ static void c_post_options () diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index b2f9969..3baa083 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -217,7 +217,7 @@ c_objc_common_init (filename) filename = c_common_init (filename); - add_c_tree_codes (); + lang_unsafe_for_reeval = c_unsafe_for_reeval; save_lang_status = &push_c_function_context; restore_lang_status = &pop_c_function_context; diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index da5796e..df0d0f5 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,11 @@ +2002-03-12 Kaveh R. Ghazi + + * decl.c (chill_tree_code_type, chill_tree_code_length, + chill_tree_code_name): Delete. + (tree_code_type, tree_code_length, tree_code_name): Define. + (init_decl_processing): Don't try to copy into the various + tree_code arrays. + 2002-02-27 Zack Weinberg * ch-tree.h, decl.c: Delete traditional-mode-related code diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c index 02070ba..01ca9e6 100644 --- a/gcc/ch/decl.c +++ b/gcc/ch/decl.c @@ -534,7 +534,8 @@ int warn_missing_braces; #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - const char chill_tree_code_type[] = { +const char tree_code_type[] = { +#include "tree.def" 'x', #include "ch-tree.def" }; @@ -546,7 +547,8 @@ int warn_missing_braces; #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, -int chill_tree_code_length[] = { +const unsigned char tree_code_length[] = { +#include "tree.def" 0, #include "ch-tree.def" }; @@ -557,7 +559,8 @@ int chill_tree_code_length[] = { Used for printing out the tree and error messages. */ #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, -const char *chill_tree_code_name[] = { +const char *const tree_code_name[] = { +#include "tree.def" "@@dummy", #include "ch-tree.def" }; @@ -3482,18 +3485,6 @@ init_decl_processing () DECL_SOURCE_LINE (temp) = 0; initializer_type = TREE_TYPE (temp); - memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE, - chill_tree_code_type, - (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (char))); - memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE, - chill_tree_code_length, - (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (int))); - memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE, - chill_tree_code_name, - (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE) - * sizeof (char *))); boolean_code_name = (const char **) xcalloc (sizeof (char *), (int) LAST_CHILL_TREE_CODE); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9d8283..7ff6499 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2002-03-12 Kaveh R. Ghazi + + * cp-lang.c (tree_code_type, tree_code_length, tree_code_name): + Define. + * decl.c (duplicate_decls): Use TREE_CODE_LENGTH, not + tree_code_length. + * lex.c (cplus_tree_code_type, cplus_tree_code_length, + cplus_tree_code_name): Delete. + (cxx_init): Don't call add_c_tree_codes, instead set + lang_unsafe_for_reeval. Don't try to copy into the various + tree_code arrays. + 2002-03-12 Nathan Sidwell PR c++/5659 diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index da0718e..1a27136 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -152,6 +152,47 @@ ok_to_generate_alias_set_for_type (t) return true; } +/* Tree code classes. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const char tree_code_type[] = { +#include "tree.def" + 'x', +#include "c-common.def" + 'x', +#include "cp-tree.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" + 0, +#include "c-common.def" + 0, +#include "cp-tree.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char *const tree_code_name[] = { +#include "tree.def" + "@@dummy", +#include "c-common.def" + "@@dummy", +#include "cp-tree.def" +}; +#undef DEFTREECODE + /* Special routine to get the alias set for C++. */ static HOST_WIDE_INT diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9b5d3e9..2417202 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3781,7 +3781,7 @@ duplicate_decls (newdecl, olddecl) memcpy ((char *) olddecl + sizeof (struct tree_common), (char *) newdecl + sizeof (struct tree_common), sizeof (struct tree_decl) - sizeof (struct tree_common) - + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *)); + + TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *)); } DECL_UID (olddecl) = olddecl_uid; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 1eb7075..5990df9 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -205,37 +205,6 @@ int interface_only; /* whether or not current file is only for int interface_unknown; /* whether or not we know this class to behave according to #pragma interface. */ -/* Tree code classes. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -static const char cplus_tree_code_type[] = { - 'x', -#include "cp-tree.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -static const int cplus_tree_code_length[] = { - 0, -#include "cp-tree.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -static const char *const cplus_tree_code_name[] = { - "@@dummy", -#include "cp-tree.def" -}; -#undef DEFTREECODE /* Post-switch processing. */ void @@ -682,17 +651,7 @@ cxx_init (filename) init_cplus_expand (); init_cp_semantics (); - add_c_tree_codes (); - - memcpy (tree_code_type + (int) LAST_C_TREE_CODE, - cplus_tree_code_type, - (int)LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE); - memcpy (tree_code_length + (int) LAST_C_TREE_CODE, - cplus_tree_code_length, - (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (int)); - memcpy (tree_code_name + (int) LAST_C_TREE_CODE, - cplus_tree_code_name, - (LAST_CPLUS_TREE_CODE - (int)LAST_C_TREE_CODE) * sizeof (char *)); + lang_unsafe_for_reeval = c_unsafe_for_reeval; init_operators (); init_method (); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 73ce8ec..0f3ec2c 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 12 20:23:18 2002 Kaveh R. Ghazi + + * com.c (tree_code_type, tree_code_length, tree_code_name): + Define. + Sun Mar 10 12:37:42 2002 Kaveh R. Ghazi * target.c (ffetarget_print_hex): Const-ify. diff --git a/gcc/f/com.c b/gcc/f/com.c index f64df2b..f895db4 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -14224,6 +14224,37 @@ static void ffe_print_identifier PARAMS ((FILE *, tree, int)); const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +/* Table indexed by tree code giving a string containing a character + classifying the tree code. Possibilities are + t, d, s, c, r, <, 1, 2 and e. See tree.def for details. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const char tree_code_type[] = { +#include "tree.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char *const tree_code_name[] = { +#include "tree.def" +}; +#undef DEFTREECODE + static const char * ffe_init (filename) const char *filename; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 4267207..be360b4 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2002-03-12 Kaveh R. Ghazi + + * lang.c (java_tree_code_type, java_tree_code_length, + tree_code_name): Delete. + (tree_code_type, tree_code_length, tree_code_name): Define. + (java_init): Don't try to copy into the various tree_code + arrays. + 2002-03-12 Tom Tromey * jcf-parse.c (get_constant) [CONSTANT_String]: String values are diff --git a/gcc/java/lang.c b/gcc/java/lang.c index a71f5cc..24e0375 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -70,7 +70,8 @@ static int process_option_with_no PARAMS ((const char *, #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, -static const char java_tree_code_type[] = { +const char tree_code_type[] = { +#include "tree.def" 'x', #include "java-tree.def" }; @@ -82,7 +83,8 @@ static const char java_tree_code_type[] = { #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, -static const int java_tree_code_length[] = { +const unsigned char tree_code_length[] = { +#include "tree.def" 0, #include "java-tree.def" }; @@ -92,7 +94,8 @@ static const int java_tree_code_length[] = { Used for printing out the tree and error messages. */ #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, -static const char *const java_tree_code_name[] = { +const char *const tree_code_name[] = { +#include "tree.def" "@@dummy", #include "java-tree.def" }; @@ -505,19 +508,6 @@ java_init (filename) print_error_function = lang_print_error; lang_expand_expr = java_lang_expand_expr; - /* Append to Gcc tree node definition arrays */ - - memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE, - java_tree_code_type, - (int)LAST_JAVA_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE); - memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE, - java_tree_code_length, - (LAST_JAVA_TREE_CODE - - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int)); - memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE, - java_tree_code_name, - (LAST_JAVA_TREE_CODE - - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *)); java_init_decl_processing (); using_eh_for_cleanups (); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 814e675..0c9e9fd 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -86,40 +86,6 @@ Boston, MA 02111-1307, USA. */ #define OBJC_FORWARDING_MIN_OFFSET 0 #endif -/* Define the special tree codes that we use. */ - -/* Table indexed by tree code giving a string containing a character - classifying the tree code. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -static const char objc_tree_code_type[] = { - 'x', -#include "objc-tree.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -static const int objc_tree_code_length[] = { - 0, -#include "objc-tree.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -static const char * const objc_tree_code_name[] = { - "@@dummy", -#include "objc-tree.def" -}; -#undef DEFTREECODE /* Set up for use of obstacks. */ @@ -270,7 +236,6 @@ static void dump_interface PARAMS ((FILE *, tree)); /* Everything else. */ -static void add_objc_tree_codes PARAMS ((void)); static tree define_decl PARAMS ((tree, tree)); static tree lookup_method_in_protocol_list PARAMS ((tree, tree, int)); static tree lookup_protocol_in_reflist PARAMS ((tree, tree)); @@ -511,7 +476,6 @@ objc_init (filename) const char *filename; { filename = c_objc_common_init (filename); - add_objc_tree_codes (); decl_printable_name = objc_printable_name; @@ -8072,22 +8036,6 @@ objc_printable_name (decl, kind) return objc_demangle (IDENTIFIER_POINTER (DECL_NAME (decl))); } -/* Adds the tree codes specific to the ObjC/ObjC++ front end to the - list of all tree codes. */ - -static void -add_objc_tree_codes () -{ - int add = (int) LAST_OBJC_TREE_CODE - (int) LAST_BASE_TREE_CODE; - - memcpy (tree_code_type + (int) LAST_BASE_TREE_CODE, - objc_tree_code_type, add); - memcpy (tree_code_length + (int) LAST_BASE_TREE_CODE, - objc_tree_code_length, add * sizeof (int)); - memcpy (tree_code_name + (int) LAST_BASE_TREE_CODE, - objc_tree_code_name, add * sizeof (char *)); -} - static void init_objc () { diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 8f155c2..2577f65 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -66,6 +66,50 @@ static void objc_post_options PARAMS ((void)); /* Each front end provides its own hooks, for toplev.c. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; +/* Define the special tree codes that we use. */ + +/* Table indexed by tree code giving a string containing a character + classifying the tree code. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const char tree_code_type[] = { +#include "tree.def" + 'x', +#include "c-common.def" + 'x', +#include "objc-tree.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" + 0, +#include "c-common.def" + 0, +#include "objc-tree.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char * const tree_code_name[] = { +#include "tree.def" + "@@dummy", +#include "c-common.def" + "@@dummy", +#include "objc-tree.def" +}; +#undef DEFTREECODE + static void objc_init_options () { diff --git a/gcc/toplev.c b/gcc/toplev.c index 656747c..fbf6e6b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4998,11 +4998,6 @@ lang_independent_init () decl_printable_name = decl_name; lang_expand_expr = (lang_expand_expr_t) do_abort; - /* Set the language-dependent identifier size. */ - tree_code_length[(int) IDENTIFIER_NODE] - = ((lang_hooks.identifier_size - sizeof (struct tree_common) - + sizeof (tree) - 1) / sizeof (tree)); - /* Initialize the garbage-collector, and string pools. */ init_ggc (); ggc_add_rtx_root (&stack_limit_rtx, 1); diff --git a/gcc/tree.c b/gcc/tree.c index 4f19508..eda2fd6 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -56,37 +56,6 @@ extern int _obstack_allocated_p PARAMS ((struct obstack *h, PTR obj)); struct obstack permanent_obstack; -/* Table indexed by tree code giving a string containing a character - classifying the tree code. Possibilities are - t, d, s, c, r, <, 1, 2 and e. See tree.def for details. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -char tree_code_type[MAX_TREE_CODES] = { -#include "tree.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -int tree_code_length[MAX_TREE_CODES] = { -#include "tree.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -const char *tree_code_name[MAX_TREE_CODES] = { -#include "tree.def" -}; -#undef DEFTREECODE - /* Statistics-gathering stuff. */ typedef enum { diff --git a/gcc/tree.def b/gcc/tree.def index 9cfe139..cd0f1c2 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -49,7 +49,7 @@ DEFTREECODE (ERROR_MARK, "error_mark", 'x', 0) Internally it looks like a STRING_CST node. There is only one IDENTIFIER_NODE ever made for any particular name. Use `get_identifier' to get it (or create it, the first time). */ -DEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', -1) +DEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', ((LANG_HOOKS_IDENTIFIER_SIZE - sizeof (struct tree_common) + sizeof (tree) - 1) / sizeof (tree))) /* Has the TREE_VALUE and TREE_PURPOSE fields. */ /* These nodes are made into lists by chaining through the diff --git a/gcc/tree.h b/gcc/tree.h index cb67df8..06b7dd5 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -46,7 +46,7 @@ enum tree_code { and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */ #define MAX_TREE_CODES 256 -extern char tree_code_type[MAX_TREE_CODES]; +extern const char tree_code_type[]; #define TREE_CODE_CLASS(CODE) tree_code_type[(int) (CODE)] /* Returns non-zero iff CLASS is the tree-code class of an @@ -57,12 +57,12 @@ extern char tree_code_type[MAX_TREE_CODES]; /* Number of argument-words in each kind of tree-node. */ -extern int tree_code_length[MAX_TREE_CODES]; +extern const unsigned char tree_code_length[]; #define TREE_CODE_LENGTH(CODE) tree_code_length[(int) (CODE)] /* Names of tree components. */ -extern const char *tree_code_name[MAX_TREE_CODES]; +extern const char *const tree_code_name[]; /* Classify which part of the compiler has defined a given builtin function. Note that we assume below that this is no more than two bits. */