* 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
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.
(default_print_error_function): Rename.
(report_error_function): Update.
+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
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
#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
{
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;
init_decl_processing. */
void
-finish_incomplete_decl (dont_care)
+gnat_finish_incomplete_decl (dont_care)
tree dont_care ATTRIBUTE_UNUSED;
{
gigi_abort (405);
}
}
-
/* 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. */
/* 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
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. */
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)
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);
#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
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;
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;
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.
* cp-lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
* cp-tree.h (struct diagnostic_context): Predeclare.
#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
init_spew ();
init_tree ();
init_cp_semantics ();
-
- lang_unsafe_for_reeval = c_unsafe_for_reeval;
-
init_operators ();
init_method ();
init_error ();
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));
#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
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 { \
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, \
return 1;
}
+/* Called from unsafe_for_reeval. */
+
+int
+lhd_unsafe_for_reeval (t)
+ tree t ATTRIBUTE_UNUSED;
+{
+ return -1;
+}
+
/* Called from staticp. */
int
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));
#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
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;
/* 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
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
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;
}
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.
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,