]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-common.c (c_unsafe_for_reeval): Rename.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Sun, 31 Mar 2002 22:40:57 +0000 (22:40 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Sun, 31 Mar 2002 22:40:57 +0000 (22:40 +0000)
* c-common.c (c_unsafe_for_reeval): Rename.
* c-common.h (c_unsafe_for_reeval): Rename.
* c-decl.c (finish_incomplete_decl): Rename.
(c_init_decl_processing): Don't set langhook.
* c-lang.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL,
LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
* c-objc-common.c (c_objc_common_init): Don't set langhook.
* c-tree.h (finish_incomplete_decl): Rename.
* langhooks-def.h (lhd_unsafe_for_reeval): New.
(LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_unsafe_For_reeval): New.
* langhooks.h (struct langhooks): New hooks.
* toplev.c (incomplete_decl_finalize_hook): Remove.
(wrapup_global_declarations): Update.
* tree.c (lang_unsafe_for_reeval): Remove.
(unsafe_for_reeval): Update.
* tree.h (lang_unsafe_for_reeval, incomplete_decl_finalize_hook):
Remove.
ada:
* gigi.h (finish_incomplete_decl): Rename.
* misc.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL): Redefine.
* utils.c (gnat_init_decl_processing): Don't set hook.
(finish_incomplete_decl): Rename.
cp:
* cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
* lex.c (cxx_init): Don't set hook.
objc:
* objc-lang.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL,
LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.

From-SVN: r51673

21 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gigi.h
gcc/ada/misc.c
gcc/ada/utils.c
gcc/c-common.c
gcc/c-common.h
gcc/c-decl.c
gcc/c-lang.c
gcc/c-objc-common.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/lex.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/objc/objc-lang.c
gcc/toplev.c
gcc/tree.c
gcc/tree.h

index 7dc14c0894b1d5c610b4bf8e99e4b4ff0e4b4560..9f4d8d939c99c266327f5775593af8acc7035fde 100644 (file)
@@ -1,3 +1,28 @@
+2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * c-common.c (c_unsafe_for_reeval): Rename.
+       * c-common.h (c_unsafe_for_reeval): Rename.
+       * c-decl.c (finish_incomplete_decl): Rename.
+       (c_init_decl_processing): Don't set langhook.
+       * c-lang.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL,
+       LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
+       * c-objc-common.c (c_objc_common_init): Don't set langhook.
+       * c-tree.h (finish_incomplete_decl): Rename.
+       * langhooks-def.h (lhd_unsafe_for_reeval): New.
+       (LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL): New.
+       (LANG_HOOKS_INITIALIZER): Update.
+       * langhooks.c (lhd_unsafe_For_reeval): New.
+       * langhooks.h (struct langhooks): New hooks.
+       * toplev.c (incomplete_decl_finalize_hook): Remove.
+       (wrapup_global_declarations): Update.
+       * tree.c (lang_unsafe_for_reeval): Remove.
+       (unsafe_for_reeval): Update.
+       * tree.h (lang_unsafe_for_reeval, incomplete_decl_finalize_hook):
+       Remove.
+objc:
+       * objc-lang.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL,
+       LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
+
 2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * diagnostic.c (print_error_function): Remove.
index ddc24fddf6199fb37c4d838ac2cfa085b472e36f..062c7e6041130dae4390e6581bfe6deb55b81350 100644 (file)
@@ -1,3 +1,10 @@
+2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * gigi.h (finish_incomplete_decl): Rename.
+       * misc.c (LANG_HOOKS_FINISH_INCOMPLETE_DECL): Redefine.
+       * utils.c (gnat_init_decl_processing): Don't set hook.
+       (finish_incomplete_decl): Rename.
+
 2002-03-29  Andreas Schwab  <schwab@suse.de>
 
        * Makefile.in: Pass VPATH=$(fsrcdir) when calling make in rts
index 0223eac3c591348e864cc893afb0238971759f04..de05d4eea76a837407746a9001237bf5d9c35bad 100644 (file)
@@ -448,7 +448,7 @@ extern void incomplete_type_error   PARAMS ((tree, tree));
    compile_file in toplev.c makes an indirect call through the function pointer
    incomplete_decl_finalize_hook which is initialized to this routine in
    init_decl_processing.  */
-extern void finish_incomplete_decl     PARAMS ((tree));
+extern void gnat_finish_incomplete_decl        PARAMS ((tree));
 
 /* Create an expression whose value is that of EXPR,
    converted to type TYPE.  The TREE_TYPE of the value
index 78222c2f8d74017df6c747c2d6100b5f94624207..8edbba4c5173559b25f2096facc0e4e7e2beb8e6 100644 (file)
@@ -108,6 +108,8 @@ static rtx gnat_expand_expr         PARAMS ((tree, rtx, enum machine_mode,
 #define LANG_HOOKS_MARK_TREE           gnat_mark_tree
 #undef LANG_HOOKS_HONOR_READONLY
 #define LANG_HOOKS_HONOR_READONLY      1
+#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
+#define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl
 #undef LANG_HOOKS_GET_ALIAS_SET
 #define LANG_HOOKS_GET_ALIAS_SET       gnat_get_alias_set
 #undef LANG_HOOKS_EXPAND_EXPR
index d01e7d84a4d22055fc205e117a2750d0a66749fa..6d8f637bf45d3d787869bc22d40d50fa4546942b 100644 (file)
@@ -481,12 +481,6 @@ gnat_init_decl_processing ()
 {
   lineno = 0;
 
-  /* incomplete_decl_finalize_hook is defined in toplev.c. It needs to be set
-     by each front end to the appropriate routine that handles incomplete 
-     VAR_DECL nodes. This routine will be invoked by compile_file when a  
-     VAR_DECL node of DECL_SIZE zero is encountered.  */
-  incomplete_decl_finalize_hook = finish_incomplete_decl;
-
   /* Make the binding_level structure for global names.  */
   current_function_decl = 0;
   current_binding_level = 0;
@@ -709,7 +703,7 @@ incomplete_type_error (dont_care_1, dont_care_2)
    init_decl_processing.  */
 
 void
-finish_incomplete_decl (dont_care)
+gnat_finish_incomplete_decl (dont_care)
      tree dont_care ATTRIBUTE_UNUSED;
 {
   gigi_abort (405);
index cccd2bc8cebdc8093f006f06662e11e1cfb368fe..a3fa01737269135107998fe89b4fb0e0a9e9ecde 100644 (file)
@@ -2323,7 +2323,6 @@ c_apply_type_quals_to_decl (type_quals, decl)
     }
 }
 
-
 /* Return the typed-based alias set for T, which may be an expression
    or a type.  Return -1 if we don't do anything special.  */
 
@@ -3709,7 +3708,7 @@ c_safe_from_p (target, exp)
 /* Hook used by unsafe_for_reeval to handle language-specific tree codes.  */
 
 int
-c_unsafe_for_reeval (exp)
+c_common_unsafe_for_reeval (exp)
      tree exp;
 {
   /* Statement expressions may not be reevaluated, likewise compound
index 823b08137d2973c4ee09fd135d8fc00d324e28d7..263b227f55114dc76aa9a01438ae5df951e1825c 100644 (file)
@@ -853,7 +853,7 @@ extern int c_safe_from_p                        PARAMS ((rtx, tree));
 
 extern int c_staticp                            PARAMS ((tree));
 
-extern int c_unsafe_for_reeval                 PARAMS ((tree));
+extern int c_common_unsafe_for_reeval          PARAMS ((tree));
 
 /* Information recorded about each file examined during compilation.  */
 
index c7986218aa8a2abc330a33e82dee3ce47209bf3b..d7e70a4634c6b4d98be53d2daafa9caaa3fc8b37 100644 (file)
@@ -734,7 +734,7 @@ c_print_identifier (file, node, indent)
    for a top-level tentative array defn that wasn't complete before.  */
 
 void
-finish_incomplete_decl (decl)
+c_finish_incomplete_decl (decl)
      tree decl;
 {
   if (TREE_CODE (decl) == VAR_DECL)
@@ -2985,8 +2985,6 @@ c_init_decl_processing ()
   make_fname_decl = c_make_fname_decl;
   start_fname_decls ();
 
-  incomplete_decl_finalize_hook = finish_incomplete_decl;
-
   /* Record our roots.  */
 
   ggc_add_tree_root (c_global_trees, CTI_MAX);
index 8e9516553a5dd9ac1ae11e04ed5a985ab9d5034b..31763587f45d86945a9e03787d6722325258ac9e 100644 (file)
@@ -58,6 +58,10 @@ static void c_post_options PARAMS ((void));
 #define LANG_HOOKS_PARSE_FILE c_common_parse_file
 #undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes
+#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
+#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
+#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
+#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
 #undef LANG_HOOKS_STATICP
 #define LANG_HOOKS_STATICP c_staticp
 #undef LANG_HOOKS_PRINT_IDENTIFIER
index 595e6cec75664a987e9eb5ffa85ec9d6ba5320d7..5207abda080dda4cdd7fec990e5c191d971f787e 100644 (file)
@@ -220,8 +220,6 @@ c_objc_common_init (filename)
   if (filename == NULL)
     return NULL;
 
-  lang_unsafe_for_reeval = c_unsafe_for_reeval;
-
   save_lang_status = &push_c_function_context;
   restore_lang_status = &pop_c_function_context;
   mark_lang_status = &mark_c_function_context;
index 57c335d0d644011cff266474560120331b96ca5a..12ae456adb8c2abaf51be5023b82e79127c092b6 100644 (file)
@@ -383,7 +383,7 @@ extern int system_header_p;
 extern int mesg_implicit_function_declaration;
 
 /* In c-decl.c */
-extern void finish_incomplete_decl PARAMS ((tree));
+extern void c_finish_incomplete_decl PARAMS ((tree));
 
 extern tree static_ctors;
 extern tree static_dtors;
index 46bb356939515a60b1e55cc08ad65c30205442bd..3f81db3df6eab67cbdd0bd946665c76baa7fc509 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
+       * lex.c (cxx_init): Don't set hook.
+
 2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * Make-lang.in (error.o): Update.
index 31ee285753e112cb3e1459697608e6a41f357ce1..28d3add1c3e4bd2ec53f90e7cde2b96b6a97ff10 100644 (file)
@@ -65,6 +65,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES cxx_insert_default_attributes
 #undef LANG_HOOKS_MARK_TREE
 #define LANG_HOOKS_MARK_TREE cxx_mark_tree
+#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
+#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
 #undef LANG_HOOKS_PRINT_STATISTICS
 #define LANG_HOOKS_PRINT_STATISTICS cxx_print_statistics
 #undef LANG_HOOKS_PRINT_XNODE
index 7e442fbc70e10a3adefb5d63dc22b52ba10048e8..2f6148711a46792fcd998579f5d2c8c15665d78e 100644 (file)
@@ -648,9 +648,6 @@ cxx_init (filename)
   init_spew ();
   init_tree ();
   init_cp_semantics ();
-
-  lang_unsafe_for_reeval = c_unsafe_for_reeval;
-
   init_operators ();
   init_method ();
   init_error ();
index 8ffd2a8af37bb3846f42eb564b3241e07d7d211e..49f80c0224e0fcf676eb00de6b2c9c64b6a6c729 100644 (file)
@@ -47,6 +47,7 @@ extern tree lhd_return_tree PARAMS ((tree));
 extern tree lhd_return_null_tree PARAMS ((tree));
 extern int lhd_safe_from_p PARAMS ((rtx, tree));
 extern int lhd_staticp PARAMS ((tree));
+extern int lhd_unsafe_for_reeval PARAMS ((tree));
 extern void lhd_clear_binding_stack PARAMS ((void));
 extern void lhd_print_tree_nothing PARAMS ((FILE *, tree, int));
 extern const char *lhd_decl_printable_name PARAMS ((tree, int));
@@ -85,6 +86,8 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
 #define LANG_HOOKS_EXPAND_CONSTANT     lhd_return_tree
 #define LANG_HOOKS_EXPAND_EXPR         lhd_expand_expr
 #define LANG_HOOKS_SAFE_FROM_P         lhd_safe_from_p
+#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
+#define LANG_HOOKS_UNSAFE_FOR_REEVAL   lhd_unsafe_for_reeval
 #define LANG_HOOKS_STATICP             lhd_staticp
 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES lhd_do_nothing_t
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
@@ -150,8 +153,8 @@ int lhd_tree_dump_type_quals                        PARAMS ((tree));
   LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
 }
 
-/* Types hooks.  No default for LANG_HOOKS_TYPE_FOR_MODE or
-   LANG_HOOKS_TYPE_FOR_SIZE.  */
+/* Types hooks.  There are no reasonable defaults for most of them,
+   so we create a compile-time error instead.  */
 #define LANG_HOOKS_MAKE_TYPE make_node
 
 #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
@@ -195,6 +198,8 @@ int lhd_tree_dump_type_quals                        PARAMS ((tree));
   LANG_HOOKS_EXPAND_EXPR, \
   LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES, \
   LANG_HOOKS_SAFE_FROM_P, \
+  LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
+  LANG_HOOKS_UNSAFE_FOR_REEVAL, \
   LANG_HOOKS_STATICP, \
   LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
   LANG_HOOKS_UNSAVE_EXPR_NOW, \
index ec538b8c14d3173923a82840707f7a69a7a663e7..92877117e5db8ca6b49d95c3a91c832f100344a7 100644 (file)
@@ -95,6 +95,15 @@ lhd_safe_from_p (x, exp)
   return 1;
 }
 
+/* Called from unsafe_for_reeval.  */
+
+int
+lhd_unsafe_for_reeval (t)
+     tree t ATTRIBUTE_UNUSED;
+{
+  return -1;
+}
+
 /* Called from staticp.  */
 
 int
index e0aad78212180bae285b45f7aae1389e7bacc990..8a0f4b54e9e5e4ba388eaf7da7252ae96faa97b1 100644 (file)
@@ -197,6 +197,15 @@ struct lang_hooks
      parameter.  */
   int (*safe_from_p) PARAMS ((rtx, tree));
 
+  /* Function to finish handling an incomplete decl at the end of
+     compilation.  Default hook is does nothing.  */
+  void (*finish_incomplete_decl) PARAMS ((tree));
+
+  /* Function used by unsafe_for_reeval.  A non-negative number is
+     returned directly from unsafe_for_reeval, a negative number falls
+     through.  The default hook returns a negative number.  */
+  int (*unsafe_for_reeval) PARAMS ((tree));
+
   /* Hook called by staticp for language-specific tree codes.  */
   int (*staticp) PARAMS ((tree));
 
index aa7e308ecbdc42d947725d443e43fb3523f7210d..b493cfcc0bf72f920e9feed37106cf23d7e161e8 100644 (file)
@@ -52,6 +52,10 @@ static void objc_post_options                   PARAMS ((void));
 #define LANG_HOOKS_EXPAND_EXPR c_expand_expr
 #undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES
 #define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes
+#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
+#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
+#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
+#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
 #undef LANG_HOOKS_STATICP
 #define LANG_HOOKS_STATICP c_staticp
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
index 1baf772452bddc0178ee7a3b184a73fff77b941b..24009593366b30c164b5e1002ca9d37c641ac55b 100644 (file)
@@ -349,11 +349,6 @@ tree current_function_decl;
    if none.  */
 tree current_function_func_begin_label;
 
-/* Pointer to function to finish handling an incomplete decl at the
-   end of compilation.  */
-
-void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
-
 /* Nonzero if doing dwarf2 duplicate elimination.  */
 
 int flag_eliminate_dwarf2_dups = 0;
@@ -1822,9 +1817,8 @@ wrapup_global_declarations (vec, len)
       /* We're not deferring this any longer.  */
       DECL_DEFER_OUTPUT (decl) = 0;
 
-      if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
-         && incomplete_decl_finalize_hook != 0)
-       (*incomplete_decl_finalize_hook) (decl);
+      if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
+       (*lang_hooks.finish_incomplete_decl) (decl);
     }
 
   /* Now emit any global variables or functions that we have been
index 98ac6bc663bad8d369a52ca769fb4eb5c5832695..47408914f3209455754e05f93077b333da53405e 100644 (file)
@@ -133,10 +133,6 @@ static int type_hash_marked_p PARAMS ((const void *));
 static void type_hash_mark PARAMS ((const void *));
 static int mark_tree_hashtable_entry PARAMS((void **, void *));
 
-/* If non-null, these are language-specific helper functions for
-   unsafe_for_reeval.  Return negative to not handle some tree.  */
-int (*lang_unsafe_for_reeval) PARAMS ((tree));
-
 /* Set the DECL_ASSEMBLER_NAME for a node.  If it is the sort of thing
    that the assembler should talk about, set DECL_ASSEMBLER_NAME to an
    appropriate IDENTIFIER_NODE.  Otherwise, set it to the
@@ -1688,12 +1684,9 @@ unsafe_for_reeval (expr)
       break;
 
     default:
-      if (lang_unsafe_for_reeval != 0)
-       {
-         tmp = (*lang_unsafe_for_reeval) (expr);
-         if (tmp >= 0)
-           return tmp;
-       }
+      tmp = (*lang_hooks.unsafe_for_reeval) (expr);
+      if (tmp >= 0)
+       return tmp;
       break;
     }
 
index 58b2ebae4103bc2aec2c36048e2be8f7f291dfb4..e6f0377e2a83aadcd3c7a19440cc629a40c3196c 100644 (file)
@@ -2553,10 +2553,6 @@ extern void unsave_expr_1               PARAMS ((tree));
    return 2 if it is completely unsafe.  */
 extern int unsafe_for_reeval           PARAMS ((tree));
 
-/* If non-null, these are language-specific helper functions for
-   unsafe_for_reeval.  Return negative to not handle some tree.  */
-extern int (*lang_unsafe_for_reeval)   PARAMS ((tree));
-
 /* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
    or offset that depends on a field within a record.
 
@@ -2691,11 +2687,6 @@ extern tree current_function_func_begin_label;
 
 extern int all_types_permanent;
 
-/* Pointer to function to finish handling an incomplete decl at the
-   end of compilation.  */
-
-extern void (*incomplete_decl_finalize_hook)   PARAMS ((tree));
-
 /* Declare a predefined function.  Return the declaration.  This function is
    provided by each language frontend.  */
 extern tree builtin_function                   PARAMS ((const char *, tree, int,