]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Makefile.in (fold-const.o, [...]): Update.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Thu, 21 Mar 2002 18:39:29 +0000 (18:39 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Thu, 21 Mar 2002 18:39:29 +0000 (18:39 +0000)
* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
sdbout.o, profile.o): Update.
* c-common.c (c_common_nodes_and_builtins): Use pushdecl
langhook.
* c-common.h (gettags): Move here from tree.h.
* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
* dbxout.c (dbxout_init): Use getdecls langhook.
* expr.c (expand_expr): Use insert_block langhook.
* fold-const.c: Include langhooks.h.
(fold_range_test, fold_binary_op_with_conditional_arg,
fold): Use global_bindings_p langhook.
* integrate.c (expand_inline_function): Use insert_block langhook.
* langhooks-def.h (LANG_HOOKS_DECLS, LANG_HOOKS_PUSHLEVEL,
LANG_HOOKS_POPLEVEL, LANG_HOOKS_GLOBAL_BINDINGS_P,
LANG_HOOKS_INSERT_BLOCK, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_PUSHDECL,
LANG_HOOKS_GETDECLS): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
langhook.
* langhooks.h (struct lang_hooks_for_decls): New.
(struct lang_hooks): Update.
* profile.c: Include langhooks.h.
(output_func_start_profiler): Use new langhooks.
* sdbout.c: Include langhooks.h.
(sdbout_init, sdbout_finish): Use getdecls langhook.
* stmt.c: Include langhooks.h.
(expand_fixup, fixup_gotos): Use new langhooks.
* stor-layout.c: Include langhooks.h.
(variable_size): Use global_bindings_p langhook.
* toplev.c (compile_file): Use getdecls langhook.
* tree-inline.c (remap_block): Use insert_block langhook.
* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
cp:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
java:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
f:
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.

From-SVN: r51136

25 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-common.c
gcc/c-common.h
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/dbxout.c
gcc/expr.c
gcc/f/ChangeLog
gcc/f/com.h
gcc/fold-const.c
gcc/integrate.c
gcc/java/ChangeLog
gcc/java/java-tree.h
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/profile.c
gcc/sdbout.c
gcc/stmt.c
gcc/stor-layout.c
gcc/toplev.c
gcc/tree-inline.c
gcc/tree.h

index dcdee3ff9b886b06b7dd7341411371e7c65c435c..de97f031a942f4017e133ceb15f4a496cc4d127a 100644 (file)
@@ -1,3 +1,40 @@
+2002-03-21  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * Makefile.in (fold-const.o, stor-layout.o, stmt.o,
+       sdbout.o, profile.o): Update.
+       * c-common.c (c_common_nodes_and_builtins): Use pushdecl
+       langhook.
+       * c-common.h (gettags): Move here from tree.h.
+       * c-tree.h (pushdecl, pushlevel, poplevel, set_block,
+       insert_block, getdecls, kept_level_p, global_bindings_p): New.
+       * dbxout.c (dbxout_init): Use getdecls langhook.
+       * expr.c (expand_expr): Use insert_block langhook.
+       * fold-const.c: Include langhooks.h.
+       (fold_range_test, fold_binary_op_with_conditional_arg,
+       fold): Use global_bindings_p langhook.
+       * integrate.c (expand_inline_function): Use insert_block langhook.
+       * langhooks-def.h (LANG_HOOKS_DECLS, LANG_HOOKS_PUSHLEVEL,
+       LANG_HOOKS_POPLEVEL, LANG_HOOKS_GLOBAL_BINDINGS_P,
+       LANG_HOOKS_INSERT_BLOCK, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_PUSHDECL,
+       LANG_HOOKS_GETDECLS): New.
+       (LANG_HOOKS_INITIALIZER): Update.
+       * langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
+       langhook.
+       * langhooks.h (struct lang_hooks_for_decls): New.
+       (struct lang_hooks): Update.
+       * profile.c: Include langhooks.h.
+       (output_func_start_profiler): Use new langhooks.
+       * sdbout.c: Include langhooks.h.
+       (sdbout_init, sdbout_finish): Use getdecls langhook.
+       * stmt.c: Include langhooks.h.
+       (expand_fixup, fixup_gotos): Use new langhooks.
+       * stor-layout.c: Include langhooks.h.
+       (variable_size): Use global_bindings_p langhook.
+       * toplev.c (compile_file): Use getdecls langhook.
+       * tree-inline.c (remap_block): Use insert_block langhook.
+       * tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
+       insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
+
 2002-03-21  Richard Henderson  <rth@redhat.com>
 
        * config/rs6000/rs6000.c (rs6000_select_rtx_section): Put symbolic
index 2f967dfe0b131bd0be3c9d855763a4e82d0699bf..2a9df4901faeca91cfc2e32b6d60124ac3ebae44 100644 (file)
@@ -1335,9 +1335,10 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \
 print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H) \
    langhooks.h
 stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
-   function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H)
+   function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H) \
+   langhooks.h
 fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
-   toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H)
+   toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h
 diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
    $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
    input.h toplev.h intl.h langhooks.h
@@ -1379,7 +1380,8 @@ function.o : function.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    $(TM_P_H) langhooks.h
 stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h function.h  \
    insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \
-   $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H)
+   $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) \
+   langhooks.h
 except.o : except.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    except.h function.h $(EXPR_H) libfuncs.h integrate.h \
    insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
@@ -1410,7 +1412,7 @@ debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H)
 sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
    function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \
    insn-config.h $(OBSTACK_H) xcoffout.h c-pragma.h ggc.h \
-   sdbout.h toplev.h $(TM_P_H) except.h debug.h
+   sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h
 dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \
    flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \
    debug.h langhooks.h
@@ -1472,7 +1474,8 @@ conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) $(HASHTAB_H) \
    $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H)
 profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
-   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H)
+   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H) \
+   langhooks.h
 loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \
    insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
    real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h \
index 28920599deae902a7b2de49c4b8c5de73497fc02..cae7ca8240d450407ca4a301ee984cacfa339e6c 100644 (file)
@@ -2575,31 +2575,43 @@ c_common_nodes_and_builtins ()
   record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
 
   /* These are types that type_for_size and type_for_mode use.  */
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           intQI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           intHI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           intSI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           intDI_type_node));
 #if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
+                                           get_identifier ("__int128_t"),
+                                           intTI_type_node));
 #endif
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           unsigned_intQI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           unsigned_intHI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           unsigned_intSI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           unsigned_intDI_type_node));
 #if HOST_BITS_PER_WIDE_INT >= 64
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
+                                           get_identifier ("__uint128_t"),
+                                           unsigned_intTI_type_node));
 #endif
 
   /* Create the widest literal types.  */
   widest_integer_literal_type_node
     = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-                       widest_integer_literal_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           widest_integer_literal_type_node));
 
   widest_unsigned_literal_type_node
     = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
-  pushdecl (build_decl (TYPE_DECL, NULL_TREE,
-                       widest_unsigned_literal_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
+                                           widest_unsigned_literal_type_node));
 
   /* `unsigned long' is the standard type for sizeof.
      Note that stddef.h uses `unsigned long',
@@ -2615,14 +2627,18 @@ c_common_nodes_and_builtins ()
   record_builtin_type (RID_DOUBLE, NULL, double_type_node);
   record_builtin_type (RID_MAX, "long double", long_double_type_node);
 
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
-                       complex_integer_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
-                       complex_float_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
-                       complex_double_type_node));
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
-                       complex_long_double_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
+                                           get_identifier ("complex int"),
+                                           complex_integer_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
+                                           get_identifier ("complex float"),
+                                           complex_float_type_node));
+  (*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
+                                           get_identifier ("complex double"),
+                                           complex_double_type_node));
+  (*lang_hooks.decls.pushdecl)
+    (build_decl (TYPE_DECL, get_identifier ("complex long double"),
+                complex_long_double_type_node));
 
   record_builtin_type (RID_VOID, NULL, void_type_node);
 
@@ -2692,14 +2708,17 @@ c_common_nodes_and_builtins ()
     = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
   unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
 
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
-                       va_list_type_node));
+  (*lang_hooks.decls.pushdecl)
+    (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
+                va_list_type_node));
 
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_ptrdiff_t"),
-                       ptrdiff_type_node));
+  (*lang_hooks.decls.pushdecl)
+    (build_decl (TYPE_DECL, get_identifier ("__builtin_ptrdiff_t"),
+                ptrdiff_type_node));
 
-  pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_size_t"),
-                       sizetype));
+  (*lang_hooks.decls.pushdecl)
+    (build_decl (TYPE_DECL, get_identifier ("__builtin_size_t"),
+                sizetype));
 
   if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
     {
index f93e6fe29cf87cf762a5e5c489ceb2aebf6e0845..0e8fa954acef52039133d4815facc9ac33ee664e 100644 (file)
@@ -320,6 +320,7 @@ extern int (*lang_statement_code_p)             PARAMS ((enum tree_code));
 extern void (*lang_expand_stmt)                 PARAMS ((tree));
 extern void (*lang_expand_decl_stmt)            PARAMS ((tree));
 extern void (*lang_expand_function_end)         PARAMS ((void));
+extern tree gettags                            PARAMS ((void));
 
 /* Callback that determines if it's ok for a function to have no
    noreturn attribute.  */
index f01b5238d0e033a6024c196f721374133d517dd7..8ce73aa48a5ac43dc426790b01cc6e1f0197f883 100644 (file)
@@ -166,6 +166,15 @@ extern void c_set_yydebug                  PARAMS ((int));
 extern void gen_aux_info_record                 PARAMS ((tree, int, int, int));
 
 /* in c-decl.c */
+extern int global_bindings_p                   PARAMS ((void));
+extern int kept_level_p                                PARAMS ((void));
+extern tree getdecls                           PARAMS ((void));
+extern void pushlevel                          PARAMS ((int));
+extern tree poplevel                           PARAMS ((int,int, int));
+extern void insert_block                       PARAMS ((tree));
+extern void set_block                          PARAMS ((tree));
+extern tree pushdecl                           PARAMS ((tree));
+
 extern void c_init_decl_processing             PARAMS ((void));
 extern void c_dup_lang_specific_decl           PARAMS ((tree));
 extern void c_print_identifier                 PARAMS ((FILE *, tree, int));
@@ -191,7 +200,6 @@ extern tree implicitly_declare                  PARAMS ((tree));
 extern void implicit_decl_warning               PARAMS ((tree));
 extern int  in_parm_level_p                     PARAMS ((void));
 extern void keep_next_level                     PARAMS ((void));
-extern int  kept_level_p                        PARAMS ((void));
 extern tree lookup_name                         PARAMS ((tree));
 extern tree lookup_name_current_level          PARAMS ((tree));
 extern void parmlist_tags_warning               PARAMS ((void));
index 96b7f46cbaa6a894dc13a6bc6634f39ae157c8fe..6cd614cc81e81fd5e7def533f8e72051958e62c4 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-21  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
+       insert_block, getdecls, global_bindings_p): New.
+
 2002-03-20  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/4361
index 35e1da9d9f53dd9a2248d0f9b2e8a4dbf67cefde..f213f7bf2eab98c7071878c31ba9c2e51271b383 100644 (file)
@@ -3659,12 +3659,18 @@ extern void clone_function_decl                 PARAMS ((tree, int));
 extern void adjust_clone_args                  PARAMS ((tree));
 
 /* decl.c */
-/* resume_binding_level */
+extern int global_bindings_p                   PARAMS ((void));
+extern int kept_level_p                                PARAMS ((void));
+extern tree getdecls                           PARAMS ((void));
+extern void pushlevel                          PARAMS ((int));
+extern tree poplevel                           PARAMS ((int,int, int));
+extern void insert_block                       PARAMS ((tree));
+extern void set_block                          PARAMS ((tree));
+extern tree pushdecl                           PARAMS ((tree));
 extern void cxx_init_decl_processing           PARAMS ((void));
 extern int toplevel_bindings_p                 PARAMS ((void));
 extern int namespace_bindings_p                        PARAMS ((void));
 extern void keep_next_level                    PARAMS ((int));
-extern int kept_level_p                                PARAMS ((void));
 extern int template_parm_scope_p               PARAMS ((void));
 extern void set_class_shadows                  PARAMS ((tree));
 extern void maybe_push_cleanup_level           PARAMS ((tree));
index b74aa1269a4f1a09300440f195817effa4e7f7a3..da3c8421ee4f683c0c6414d3b3dc4fc304058b0a 100644 (file)
@@ -412,7 +412,7 @@ dbxout_init (input_file_name)
      const char *input_file_name;
 {
   char ltext_label_name[100];
-  tree syms = getdecls ();
+  tree syms = (*lang_hooks.decls.getdecls) ();
 
   asmfile = asm_out_file;
 
index 130657ec8ba4c9fce270f584d348dd44223ecac7..876dfb9e3abb827e392636da9947cd12e5e89acb 100644 (file)
@@ -6526,7 +6526,7 @@ expand_expr (exp, target, tmode, modifier)
        /* Mark the corresponding BLOCK for output in its proper place.  */
        if (TREE_OPERAND (exp, 2) != 0
            && ! TREE_USED (TREE_OPERAND (exp, 2)))
-         insert_block (TREE_OPERAND (exp, 2));
+         (*lang_hooks.decls.insert_block) (TREE_OPERAND (exp, 2));
 
        /* If VARS have not yet been expanded, expand them now.  */
        while (vars)
index 690a4ee5d5eb8e8510c7cef8df9c44002fc727d7..48888e2b8cdd8c2db04e3ba132cc8b3324a0cdf6 100644 (file)
@@ -1,3 +1,8 @@
+Thu Mar 21 18:55:41 2002  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
+       insert_block, getdecls, global_bindings_p): New.
+
 Wed Mar 20 08:03:42 2002  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * com.c (lang_printable_name): Rename.
index 6fe003eb088b8ec7807b71afeae421479e1e68ef..90d231cfeca401383d95f60c2df8f11140aed8a2 100644 (file)
@@ -157,8 +157,13 @@ struct _ffecom_symbol_
 #include "storag.h"
 #include "symbol.h"
 
-/* Structure definitions. */
-
+extern int global_bindings_p                   PARAMS ((void));
+extern tree getdecls                           PARAMS ((void));
+extern void pushlevel                          PARAMS ((int));
+extern tree poplevel                           PARAMS ((int,int, int));
+extern void insert_block                       PARAMS ((tree));
+extern void set_block                          PARAMS ((tree));
+extern tree pushdecl                           PARAMS ((tree));
 
 /* Global objects accessed by users of this module. */
 
index 054cd45d11de0e5477238e20baace210b4ea5481..39d18bb30fa3b6851791c743b90d844cf9aff164 100644 (file)
@@ -52,6 +52,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "toplev.h"
 #include "ggc.h"
 #include "hashtab.h"
+#include "langhooks.h"
 
 static void encode             PARAMS ((HOST_WIDE_INT *,
                                         unsigned HOST_WIDE_INT,
@@ -3336,7 +3337,7 @@ fold_range_test (exp)
                      TREE_TYPE (exp), TREE_OPERAND (exp, 0),
                      TREE_OPERAND (exp, 1));
 
-      else if (global_bindings_p () == 0
+      else if ((*lang_hooks.decls.global_bindings_p) () == 0
               && ! contains_placeholder_p (lhs))
        {
          tree common = save_expr (lhs);
@@ -4341,7 +4342,7 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
      in that case.  */
   
   if (TREE_CODE (arg) != SAVE_EXPR && ! TREE_CONSTANT (arg)
-      && global_bindings_p () == 0
+      && (*lang_hooks.decls.global_bindings_p) () == 0
       && ((TREE_CODE (arg) != VAR_DECL
           && TREE_CODE (arg) != PARM_DECL)
          || TREE_SIDE_EFFECTS (arg)))
@@ -4623,7 +4624,7 @@ fold (expr)
               && (TREE_CODE (arg0) != COND_EXPR
                   || count_cond (arg0, 25) + count_cond (arg1, 25) <= 25)
               && (! TREE_SIDE_EFFECTS (arg0)
-                  || (global_bindings_p () == 0
+                  || ((*lang_hooks.decls.global_bindings_p) () == 0
                       && ! contains_placeholder_p (arg0))))
        return 
          fold_binary_op_with_conditional_arg (code, type, arg1, arg0,
@@ -4637,7 +4638,7 @@ fold (expr)
               && (TREE_CODE (arg1) != COND_EXPR
                   || count_cond (arg0, 25) + count_cond (arg1, 25) <= 25)
               && (! TREE_SIDE_EFFECTS (arg1)
-                  || (global_bindings_p () == 0
+                  || ((*lang_hooks.decls.global_bindings_p) () == 0
                       && ! contains_placeholder_p (arg1))))
        return 
          fold_binary_op_with_conditional_arg (code, type, arg0, arg1,
@@ -5249,7 +5250,8 @@ fold (expr)
          if (real_onep (arg1))
            return non_lvalue (convert (type, arg0));
          /* x*2 is x+x */
-         if (! wins && real_twop (arg1) && global_bindings_p () == 0
+         if (! wins && real_twop (arg1)
+             && (*lang_hooks.decls.global_bindings_p) () == 0
              && ! contains_placeholder_p (arg0))
            {
              tree arg = save_expr (arg0);
index 8646859e4f6f1aedd2d4267e8018e05e499532f3..96366e35a12bf7f6da8128f5c44e2f546db92bd6 100644 (file)
@@ -1240,7 +1240,7 @@ expand_inline_function (fndecl, parms, target, ignore, type,
        this block to the list of blocks at this binding level.  We
        can't do it the way it's done for function-at-a-time mode the
        superblocks have not been created yet.  */
-    insert_block (block);
+    (*lang_hooks.decls.insert_block) (block);
   else
     {
       BLOCK_CHAIN (block)
index ebbdc1dcf2cfd9485a0fe724485c0ca1a01973be..7afd69d28f1a3cd71cbfb74770ec3fc6de5fd775 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-21  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
+       insert_block, getdecls, kept_level_p, global_bindings_p): New.
+
 2002-03-20  Nic Ferrier  <nferrier@tapsellferrier.co.uk>
 
                * gcj.texi: @code{gcj} becomes @command{gcj}. 
index aa92f2718be1370ddf4deca9642ce2d3ada6aa39..5fde938b6636fb7f8dc67b20fc1e97592e26f3e9 100644 (file)
@@ -1072,6 +1072,14 @@ extern tree ident_subst PARAMS ((const char*, int,
                                const char*, int, int, const char*));
 extern tree identifier_subst PARAMS ((const tree,
                                     const char *, int, int, const char *));
+extern int global_bindings_p                   PARAMS ((void));
+extern int kept_level_p                                PARAMS ((void));
+extern tree getdecls                           PARAMS ((void));
+extern void pushlevel                          PARAMS ((int));
+extern tree poplevel                           PARAMS ((int,int, int));
+extern void insert_block                       PARAMS ((tree));
+extern void set_block                          PARAMS ((tree));
+extern tree pushdecl                           PARAMS ((tree));
 extern void java_init_decl_processing PARAMS ((void));
 extern void java_dup_lang_specific_decl PARAMS ((tree));
 extern tree build_java_signature PARAMS ((tree));
index 404b4bc3689baf1a63fef30be60b854d4cc07f24..f70963e9ebf6e6d91438e58cc40657c526df1b57 100644 (file)
@@ -1,5 +1,5 @@
 /* Default macros to initialize the lang_hooks data structure.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GNU CC.
@@ -137,7 +137,26 @@ int lhd_tree_dump_type_quals                       PARAMS ((tree));
 #define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
   LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
   LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
-} \
+}
+
+/* Declaration hooks.  */
+#define LANG_HOOKS_PUSHLEVEL   pushlevel
+#define LANG_HOOKS_POPLEVEL    poplevel
+#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
+#define LANG_HOOKS_INSERT_BLOCK        insert_block
+#define LANG_HOOKS_SET_BLOCK   set_block
+#define LANG_HOOKS_PUSHDECL    pushdecl
+#define LANG_HOOKS_GETDECLS    getdecls
+
+#define LANG_HOOKS_DECLS { \
+  LANG_HOOKS_PUSHLEVEL, \
+  LANG_HOOKS_POPLEVEL, \
+  LANG_HOOKS_GLOBAL_BINDINGS_P, \
+  LANG_HOOKS_INSERT_BLOCK, \
+  LANG_HOOKS_SET_BLOCK, \
+  LANG_HOOKS_PUSHDECL, \
+  LANG_HOOKS_GETDECLS \
+}
 
 /* The whole thing.  The structure is defined in langhooks.h.  */
 #define LANG_HOOKS_INITIALIZER { \
@@ -165,7 +184,8 @@ int lhd_tree_dump_type_quals                        PARAMS ((tree));
   LANG_HOOKS_DECL_PRINTABLE_NAME, \
   LANG_HOOKS_SET_YYDEBUG, \
   LANG_HOOKS_TREE_INLINING_INITIALIZER, \
-  LANG_HOOKS_TREE_DUMP_INITIALIZER \
+  LANG_HOOKS_TREE_DUMP_INITIALIZER, \
+  LANG_HOOKS_DECLS \
 }
 
 #endif /* GCC_LANG_HOOKS_DEF_H */
index cd36889a3225112d0fc8de8ecf4cec45ff1def11..4416ba937a5bdc1ba5b989e35202d91a4d839c82 100644 (file)
@@ -1,5 +1,5 @@
 /* Default language-specific hooks.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GNU CC.
@@ -110,7 +110,7 @@ lhd_set_yydebug (value)
 void
 lhd_clear_binding_stack ()
 {
-  while (! global_bindings_p ())
+  while (! (*lang_hooks.decls.global_bindings_p) ())
     poplevel (0, 0, 0);
 }
 
index 49c2c6803a1f45d9b4832e6e9d71310ef7731e19..d2a3e482ad8a1caee2164416a40b550bf120eaec 100644 (file)
@@ -1,5 +1,5 @@
 /* The lang_hooks data structure.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -65,6 +65,43 @@ struct lang_hooks_for_tree_dump
   int (*type_quals) PARAMS ((tree));
 };
 
+/* Language hooks related to decls and the symbol table.  */
+
+struct lang_hooks_for_decls
+{
+  /* Enter a new lexical scope.  Argument is always zero when called
+     from outside the front end.  */
+  void (*pushlevel) PARAMS ((int));
+
+  /* Exit a lexical scope and return a BINDING for that scope.
+     Takes three arguments:
+     KEEP -- nonzero if there were declarations in this scope.
+     REVERSE -- reverse the order of decls before returning them.
+     FUNCTIONBODY -- nonzero if this level is the body of a function.  */
+  tree (*poplevel) PARAMS ((int, int, int));
+
+  /* Returns non-zero if we are in the global binding level.  Ada
+     returns -1 for an undocumented reason used in stor-layout.c.  */
+  int (*global_bindings_p) PARAMS ((void));
+
+  /* Insert BLOCK at the end of the list of subblocks of the
+     current binding level.  This is used when a BIND_EXPR is expanded,
+     to handle the BLOCK node inside the BIND_EXPR.  */
+  void (*insert_block) PARAMS ((tree));
+
+  /* Set the BLOCK node for the current scope level.  */
+  void (*set_block) PARAMS ((tree));
+
+  /* Function to add a decl to the current scope level.  Takes one
+     argument, a decl to add.  Returns that decl, or, if the same
+     symbol is already declared, may return a different decl for that
+     name.  */
+  tree (*pushdecl) PARAMS ((tree));
+
+  /* Returns the chain of decls so far in the current scope level.  */
+  tree (*getdecls) PARAMS ((void));
+};
+
 /* Language-specific hooks.  See langhooks-def.h for defaults.  */
 
 struct lang_hooks
@@ -177,6 +214,8 @@ struct lang_hooks
   
   struct lang_hooks_for_tree_dump tree_dump;
 
+  struct lang_hooks_for_decls decls;
+
   /* Whenever you add entries here, make sure you adjust langhooks-def.h
      and langhooks.c accordingly.  */
 };
index 09fab359a8959b1aba557d0ef3c5d453c5f53f90..881604e1e27371bd0aefd5d12a46bf0eebaebfae 100644 (file)
@@ -49,6 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "basic-block.h"
 #include "gcov-io.h"
 #include "target.h"
+#include "langhooks.h"
 
 /* Additional information about the edges we need.  */
 struct edge_info
@@ -1153,14 +1154,14 @@ output_func_start_profiler ()
 
   DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
 
-  fndecl = pushdecl (fndecl);
+  fndecl = (*lang_hooks.decls.pushdecl) (fndecl);
   rest_of_decl_compilation (fndecl, 0, 1, 0);
   announce_function (fndecl);
   current_function_decl = fndecl;
   DECL_INITIAL (fndecl) = error_mark_node;
   make_decl_rtl (fndecl, NULL);
   init_function_start (fndecl, input_filename, lineno);
-  pushlevel (0);
+  (*lang_hooks.decls.pushlevel) (0);
   expand_function_start (fndecl, 0);
 
   /* Actually generate the code to call __bb_init_func.  */
@@ -1171,7 +1172,7 @@ output_func_start_profiler ()
                     mode, 1, table_address, Pmode);
 
   expand_function_end (input_filename, lineno, 0);
-  poplevel (1, 0, 1);
+  (*lang_hooks.decls.poplevel) (1, 0, 1);
 
   /* Since fndecl isn't in the list of globals, it would never be emitted
      when it's considered to be 'safe' for inlining, so turn off
index 473d9b98969e3d5733e33fe84b971593cd4167ad..bb21ae7a3b38e9c6b8f8af6baedf153947f2ee5c 100644 (file)
@@ -58,6 +58,7 @@ AT&T C compiler.  From the example below I would conclude the following:
 #include "tm_p.h"
 #include "gsyms.h"
 #include "debug.h"
+#include "langhooks.h"
 
 /* 1 if PARM is passed to this function in memory.  */
 
@@ -1516,7 +1517,7 @@ static void
 sdbout_finish (main_filename)
      const char *main_filename ATTRIBUTE_UNUSED;
 {
-  tree decl = getdecls ();
+  tree decl = (*lang_hooks.decls.getdecls) ();
   unsigned int len = list_length (decl);
   tree *vec = (tree *) xmalloc (sizeof (tree) * len);
   unsigned int i;
@@ -1754,7 +1755,7 @@ sdbout_init (input_file_name)
 
 #ifdef RMS_QUICK_HACK_1
   tree t;
-  for (t = getdecls (); t; t = TREE_CHAIN (t))
+  for (t = (*lang_hooks.decls.getdecls) (); t; t = TREE_CHAIN (t))
     if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
        && !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
       sdbout_symbol (t, 0);
index b41b62bb8d04900b9a1de19db4008c9b3acfa3b4..559795df09254b9e1b80bb2e01f0af50e53de29c 100644 (file)
@@ -53,6 +53,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "toplev.h"
 #include "output.h"
 #include "ggc.h"
+#include "langhooks.h"
 
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
@@ -1054,7 +1055,7 @@ expand_fixup (tree_label, rtl_label, last_insn)
        TREE_USED (block) = 1;
 
        if (!cfun->x_whole_function_mode_p)
-         insert_block (block);
+         (*lang_hooks.decls.insert_block) (block);
        else
          {
            BLOCK_CHAIN (block)
@@ -1175,8 +1176,8 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
             logically be inserting the fixup code.  We do this for the
             sake of getting the debugging information right.  */
 
-         pushlevel (0);
-         set_block (f->context);
+         (*lang_hooks.decls.pushlevel) (0);
+         (*lang_hooks.decls.set_block) (f->context);
 
          /* Expand the cleanups for blocks this jump exits.  */
          if (f->cleanup_list_list)
@@ -1215,7 +1216,7 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
             destructed are still "in scope".  */
 
          cleanup_insns = get_insns ();
-         poplevel (1, 0, 0);
+         (*lang_hooks.decls.poplevel) (1, 0, 0);
 
          end_sequence ();
          emit_insns_after (cleanup_insns, f->before_jump);
@@ -1249,12 +1250,12 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
          if (TREE_CHAIN (lists) == thisblock->data.block.outer_cleanups)
            {
              start_sequence ();
-             pushlevel (0);
-             set_block (f->context);
+             (*lang_hooks.decls.pushlevel) (0);
+             (*lang_hooks.decls.set_block) (f->context);
              expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
              do_pending_stack_adjust ();
              cleanup_insns = get_insns ();
-             poplevel (1, 0, 0);
+             (*lang_hooks.decls.poplevel) (1, 0, 0);
              end_sequence ();
              if (cleanup_insns != 0)
                f->before_jump
index 4a8d7d019a129f0a8901c1cbfd14a7039f77f8c9..829500007beb29ebf05af25ac878633dd80e962f 100644 (file)
@@ -31,6 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "toplev.h"
 #include "ggc.h"
 #include "target.h"
+#include "langhooks.h"
 
 /* Set to one when set_sizetype has been called.  */
 static int sizetype_set;
@@ -151,7 +152,8 @@ variable_size (size)
      just return SIZE unchanged.  Likewise for self-referential sizes and
      constant sizes.  */
   if (TREE_CONSTANT (size)
-      || global_bindings_p () < 0 || contains_placeholder_p (size))
+      || (*lang_hooks.decls.global_bindings_p) () < 0
+      || contains_placeholder_p (size))
     return size;
 
   size = save_expr (size);
@@ -167,7 +169,7 @@ variable_size (size)
   if (TREE_CODE (size) == SAVE_EXPR)
     SAVE_EXPR_PERSISTENT_P (size) = 1;
 
-  if (global_bindings_p ())
+  if ((*lang_hooks.decls.global_bindings_p) ())
     {
       if (TREE_CONSTANT (size))
        error ("type size can't be explicitly evaluated");
index 134541734ccb0f92d87091f6bb6153b5b3e0fdc1..0f70fe13dec314c5cdaa2580577bcc59678e1d9e 100644 (file)
@@ -2098,7 +2098,7 @@ compile_file ()
   if (flag_syntax_only)
     return;
 
-  globals = getdecls ();
+  globals = (*lang_hooks.decls.getdecls) ();
 
   /* Really define vars that have had only a tentative definition.
      Really output inline functions that must actually be callable
index 831f6019c7b3fc70155fd3289ecef9e9e049f3ad..46ea052fb820c09f546e2c8df1afcbbf74b0b735 100644 (file)
@@ -257,7 +257,7 @@ remap_block (scope_stmt, decls, id)
        /* We're building a clone; DECL_INITIAL is still
           error_mark_node, and current_binding_level is the parm
           binding level.  */
-       insert_block (new_block);
+       (*lang_hooks.decls.insert_block) (new_block);
       else
        {
          /* Attach this new block after the DECL_INITIAL block for the
index 6c03df798ccb10f3e8edf1fd084efb478abff380..04e12763efef1c7aad98fc3623763161f962eb22 100644 (file)
@@ -2847,30 +2847,6 @@ extern tree invert_truthvalue    PARAMS ((tree));
 extern tree (*lang_type_promotes_to)   PARAMS ((tree));
 extern tree fold_builtin               PARAMS ((tree));
 \f
-/* The language front-end must define these functions.  */
-
-/* Functions for processing symbol declarations.  */
-/* Function to enter a new lexical scope.
-   Takes one argument: always zero when called from outside the front end.  */
-extern void pushlevel                          PARAMS ((int));
-/* Function to exit a lexical scope.  It returns a BINDING for that scope.
-   Takes three arguments:
-     KEEP -- nonzero if there were declarations in this scope.
-     REVERSE -- reverse the order of decls before returning them.
-     FUNCTIONBODY -- nonzero if this level is the body of a function.  */
-extern tree poplevel                           PARAMS ((int, int, int));
-/* Set the BLOCK node for the current scope level.  */
-extern void set_block                          PARAMS ((tree));
-/* Function to add a decl to the current scope level.
-   Takes one argument, a decl to add.
-   Returns that decl, or, if the same symbol is already declared, may
-   return a different decl for that name.  */
-extern tree pushdecl                           PARAMS ((tree));
-/* Function to return the chain of decls so far in the current scope level.  */
-extern tree getdecls                           PARAMS ((void));
-/* Function to return the chain of structure tags in the current scope level.  */
-extern tree gettags                            PARAMS ((void));
-
 extern tree build_range_type PARAMS ((tree, tree, tree));
 
 /* In alias.c */
@@ -3024,8 +3000,6 @@ extern int lang_attribute_common;
 extern int mark_addressable            PARAMS ((tree));
 extern void incomplete_type_error      PARAMS ((tree, tree));
 extern tree truthvalue_conversion      PARAMS ((tree));
-extern int global_bindings_p           PARAMS ((void));
-extern void insert_block               PARAMS ((tree));
 
 /* In integrate.c */
 extern void save_for_inline            PARAMS ((tree));