diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-10-08 20:53:41 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-10-08 20:53:41 +0000 |
commit | 19551f2985c293a1041a0e7755627e87eb1559b7 (patch) | |
tree | bb7a11127c2c3516762b371c4ac8423fd733369d /gcc | |
parent | 4a1186c3c1d25fa1ffc40f0cdfe2bb940ee31426 (diff) | |
download | gcc-19551f2985c293a1041a0e7755627e87eb1559b7.zip gcc-19551f2985c293a1041a0e7755627e87eb1559b7.tar.gz gcc-19551f2985c293a1041a0e7755627e87eb1559b7.tar.bz2 |
Make-lang.in (CXX_OBJS): Added cp-lang.o.
* Make-lang.in (CXX_OBJS): Added cp-lang.o.
(cp/cp-lang.o): New rule.
* cp-tree.h: Declare hooks.
* tree.c: Make hooks non-static.
(init_tree): Don't initialize hooks here.
* lex.c: Likewise. Move definition of lang_hooks to...
* cp-lang.c: ... new file.
From-SVN: r46095
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 3 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 62 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 12 | ||||
-rw-r--r-- | gcc/cp/lex.c | 22 | ||||
-rw-r--r-- | gcc/cp/tree.c | 24 |
6 files changed, 98 insertions, 35 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 60e8151..5b934e3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2001-10-08 Alexandre Oliva <aoliva@redhat.com> + + * Make-lang.in (CXX_OBJS): Added cp-lang.o. + (cp/cp-lang.o): New rule. + * cp-tree.h: Declare hooks. + * tree.c: Make hooks non-static. + (init_tree): Don't initialize hooks here. + * lex.c: Likewise. Move definition of lang_hooks to... + * cp-lang.c: ... new file. + 2001-10-08 Richard Henderson <rth@redhat.com> * cp-tree.h (struct lang_decl_flags): Remove declared_inline. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 65a1606..dcd7d7d 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -101,7 +101,7 @@ CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \ cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ cp/search.o cp/semantics.o cp/tree.o cp/xref.o cp/repo.o cp/dump.o \ - cp/optimize.o cp/mangle.o + cp/optimize.o cp/mangle.o cp/cp-lang.o # Use loose warnings for this front end. cp-warn = @@ -241,6 +241,7 @@ cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \ toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \ $(TM_P_H) +cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \ output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \ cp/operators.def $(TM_P_H) tree-inline.h diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c new file mode 100644 index 0000000..719f558 --- /dev/null +++ b/gcc/cp/cp-lang.c @@ -0,0 +1,62 @@ +/* Language-dependent hooks for C++. + Copyright 2001 Free Software Foundation, Inc. + Contributed by Alexandre Oliva <aoliva@redhat.com> + +This file is part of GNU CC. + +GNU CC 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. + +GNU CC 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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "tree.h" +#include "cp-tree.h" +#include "toplev.h" +#include "langhooks.h" + +#undef LANG_HOOKS_INIT +#define LANG_HOOKS_INIT cxx_init +#undef LANG_HOOKS_FINISH +#define LANG_HOOKS_FINISH cxx_finish +#undef LANG_HOOKS_INIT_OPTIONS +#define LANG_HOOKS_INIT_OPTIONS cxx_init_options +#undef LANG_HOOKS_DECODE_OPTION +#define LANG_HOOKS_DECODE_OPTION cxx_decode_option +#undef LANG_HOOKS_POST_OPTIONS +#define LANG_HOOKS_POST_OPTIONS cxx_post_options + +#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES +#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \ + cp_walk_subtrees +#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN +#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \ + cp_cannot_inline_tree_fn +#undef LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS +#define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \ + cp_add_pending_fn_decls +#undef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P +#define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \ + cp_is_overload_p +#undef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P +#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \ + cp_auto_var_in_fn_p +#undef LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING +#define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \ + cp_copy_res_decl_for_inlining +#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P +#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p + +/* Each front end provides its own hooks, for toplev.c. */ +struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0376994..116a2cd 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3866,6 +3866,10 @@ extern void yyerror PARAMS ((const char *)); extern void clear_inline_text_obstack PARAMS ((void)); extern void yyhook PARAMS ((int)); extern int cp_type_qual_from_rid PARAMS ((tree)); +extern void cxx_init PARAMS ((void)); +extern void cxx_finish PARAMS ((void)); +extern void cxx_init_options PARAMS ((void)); +extern void cxx_post_options PARAMS ((void)); /* in method.c */ extern void init_method PARAMS ((void)); @@ -4189,6 +4193,14 @@ extern int char_type_p PARAMS ((tree)); extern void verify_stmt_tree PARAMS ((tree)); extern tree find_tree PARAMS ((tree, tree)); extern linkage_kind decl_linkage PARAMS ((tree)); +extern tree cp_walk_subtrees PARAMS ((tree*, int*, walk_tree_fn, + void*, void*)); +extern int cp_cannot_inline_tree_fn PARAMS ((tree*)); +extern tree cp_add_pending_fn_decls PARAMS ((void*,tree)); +extern int cp_is_overload_p PARAMS ((tree)); +extern int cp_auto_var_in_fn_p PARAMS ((tree,tree)); +extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*, + int*, void*)); /* in typeck.c */ extern int string_conv_p PARAMS ((tree, tree, int)); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index cb69142..57daab4 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -62,10 +62,6 @@ static void handle_pragma_unit PARAMS ((cpp_reader *)); static void handle_pragma_interface PARAMS ((cpp_reader *)); static void handle_pragma_implementation PARAMS ((cpp_reader *)); static void handle_pragma_java_exceptions PARAMS ((cpp_reader *)); -static void cxx_init PARAMS ((void)); -static void cxx_finish PARAMS ((void)); -static void cxx_init_options PARAMS ((void)); -static void cxx_post_options PARAMS ((void)); #ifdef GATHER_STATISTICS #ifdef REDUCE_LENGTH @@ -241,21 +237,14 @@ static const char *const cplus_tree_code_name[] = { }; #undef DEFTREECODE -/* Each front end provides its own hooks, for toplev.c. */ -struct lang_hooks lang_hooks = {cxx_init, - cxx_finish, - cxx_init_options, - cxx_decode_option, - cxx_post_options}; - /* Post-switch processing. */ -static void +void cxx_post_options () { cpp_post_options (parse_in); } -static void +void cxx_init_options () { /* Make identifier nodes long enough for the language-specific slots. */ @@ -275,7 +264,7 @@ cxx_init_options () diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE; } -static void +void cxx_init () { c_common_lang_init (); @@ -284,10 +273,11 @@ cxx_init () init_repo (input_filename); } -static void +void cxx_finish () { - if (flag_gnu_xref) GNU_xref_end (errorcount+sorrycount); + if (flag_gnu_xref) + GNU_xref_end (errorcount+sorrycount); } const char * diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b5fc508..2c4c744 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -50,12 +50,6 @@ static tree count_trees_r PARAMS ((tree *, int *, void *)); static tree verify_stmt_tree_r PARAMS ((tree *, int *, void *)); static tree find_tree_r PARAMS ((tree *, int *, void *)); extern int cp_statement_code_p PARAMS ((enum tree_code)); -static treeopt_walk_subtrees_type cp_walk_subtrees; -static treeopt_cannot_inline_tree_fn_type cp_cannot_inline_tree_fn; -static treeopt_add_pending_fn_decls_type cp_add_pending_fn_decls; -static treeopt_tree_chain_matters_p_type cp_is_overload_p; -static treeopt_auto_var_in_fn_p_type cp_auto_var_in_fn_p; -static treeopt_copy_res_decl_for_inlining_type cp_copy_res_decl_for_inlining; static tree handle_java_interface_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree handle_com_interface_attribute PARAMS ((tree *, tree, tree, int, bool *)); @@ -2058,7 +2052,7 @@ make_ptrmem_cst (type, member) /* Apply FUNC to all language-specific sub-trees of TP in a pre-order traversal. Called from walk_tree(). */ -static tree +tree cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab) tree *tp; int *walk_subtrees_p; @@ -2129,7 +2123,7 @@ cp_walk_subtrees (tp, walk_subtrees_p, func, data, htab) /* Decide whether there are language-specific reasons to not inline a function as a tree. */ -static int +int cp_cannot_inline_tree_fn (fnp) tree *fnp; { @@ -2163,7 +2157,7 @@ cp_cannot_inline_tree_fn (fnp) handled by the caller), that thus cannot be inlined, to FNS_P, then return the latest function added to the array, PREV_FN. */ -static tree +tree cp_add_pending_fn_decls (fns_p, prev_fn) void *fns_p; tree prev_fn; @@ -2185,7 +2179,7 @@ cp_add_pending_fn_decls (fns_p, prev_fn) whether to copy a node or to preserve its chain when inlining a function. */ -static int +int cp_is_overload_p (t) tree t; { @@ -2195,7 +2189,7 @@ cp_is_overload_p (t) /* Determine whether VAR is a declaration of an automatic variable in function FN. */ -static int +int cp_auto_var_in_fn_p (var, fn) tree var, fn; { @@ -2207,7 +2201,7 @@ cp_auto_var_in_fn_p (var, fn) FN being inlined into CALLER or if the top node of target_exprs is to be used. */ -static tree +tree cp_copy_res_decl_for_inlining (result, fn, caller, decl_map_, need_decl, target_exprs) tree result, fn, caller; @@ -2270,12 +2264,6 @@ void init_tree () { make_lang_type_fn = cp_make_lang_type; - lang_walk_subtrees = cp_walk_subtrees; - lang_cannot_inline_tree_fn = cp_cannot_inline_tree_fn; - lang_add_pending_fn_decls = cp_add_pending_fn_decls; - lang_tree_chain_matters_p = cp_is_overload_p; - lang_auto_var_in_fn_p = cp_auto_var_in_fn_p; - lang_copy_res_decl_for_inlining = cp_copy_res_decl_for_inlining; lang_unsave = cp_unsave; lang_statement_code_p = cp_statement_code_p; lang_set_decl_assembler_name = mangle_decl; |