-/* Macros to initialize the lang_hooks data structure.
+/* Default macros to initialize the lang_hooks data structure.
Copyright 2001 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
#ifndef GCC_LANG_HOOKS_H
#define GCC_LANG_HOOKS_H
-/* Older hooks, that don't go in sub-structures for backward
- compatibility. */
-#ifndef LANG_HOOKS_INIT
-#define LANG_HOOKS_INIT NULL
-#endif
-#ifndef LANG_HOOKS_FINISH
-#define LANG_HOOKS_FINISH NULL
-#endif
-#ifndef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS NULL
-#endif
-#ifndef LANG_HOOKS_DECODE_OPTION
-#define LANG_HOOKS_DECODE_OPTION NULL
-#endif
-#ifndef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS NULL
-#endif
-#ifndef LANG_HOOKS_HONOR_READONLY
-#define LANG_HOOKS_HONOR_READONLY 0
-#endif
+/* Note to creators of new hooks:
+
+ The macros in this file should NOT be surrounded by a
+ #ifdef...#endif pair, since this file declares the defaults. Each
+ front end overrides any hooks it wishes to, in the file containing
+ its struct lang_hooks, AFTER including this file. */
+
+/* See toplev.h for the definition and documentation of each hook. */
+
+extern void lang_hook_default_do_nothing PARAMS ((void));
+extern int lang_hook_default_decode_option PARAMS ((int, char **));
+
+#define LANG_HOOKS_INIT lang_hook_default_do_nothing
+#define LANG_HOOKS_FINISH lang_hook_default_do_nothing
+#define LANG_HOOKS_INIT_OPTIONS lang_hook_default_do_nothing
+#define LANG_HOOKS_DECODE_OPTION lang_hook_default_decode_option
+#define LANG_HOOKS_POST_OPTIONS lang_hook_default_do_nothing
+
+#define LANG_HOOKS_HONOR_READONLY false
/* Declarations of default tree inlining hooks. */
tree tree_inlining_default_hook_walk_subtrees PARAMS ((tree*, int *,
int tree_inlining_default_hook_anon_aggr_type_p PARAMS ((tree));
/* Tree inlining hooks. */
-#ifndef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \
tree_inlining_default_hook_walk_subtrees
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
tree_inlining_default_hook_cannot_inline_tree_fn
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
tree_inlining_default_hook_disregard_inline_limits
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS
#define LANG_HOOKS_TREE_INLINING_ADD_PENDING_FN_DECLS \
tree_inlining_default_hook_add_pending_fn_decls
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P
#define LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P \
tree_inlining_default_hook_tree_chain_matters_p
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P
#define LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P \
tree_inlining_default_hook_auto_var_in_fn_p
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING
#define LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING \
tree_inlining_default_hook_copy_res_decl_for_inlining
-#endif
-#ifndef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
tree_inlining_default_hook_anon_aggr_type_p
-#endif
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
#include "cpplib.h"
#include "debug.h"
#include "target.h"
+#include "langhooks.h"
/* This is the default way of generating a method name. */
/* I am not sure it is really correct.
static int print_struct_values = 0;
+#undef LANG_HOOKS_INIT
+#define LANG_HOOKS_INIT objc_init
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS objc_init_options
+#undef LANG_HOOKS_DECODE_OPTION
+#define LANG_HOOKS_DECODE_OPTION objc_decode_option
+#undef LANG_HOOKS_POST_OPTIONS
+#define LANG_HOOKS_POST_OPTIONS objc_post_options
+
/* Each front end provides its own. */
-struct lang_hooks lang_hooks = {objc_init,
- NULL, /* objc_finish */
- objc_init_options,
- objc_decode_option,
- objc_post_options};
+struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
/* Post-switch processing. */
static void
/* Perform language-specific initialization.
This may set main_input_filename. */
- if (lang_hooks.init)
- (*lang_hooks.init) ();
+ (*lang_hooks.init) ();
/* If the input doesn't start with a #line, use the input name
as the official input file name. */
/* Language-specific end of compilation actions. */
finish_syntax:
- if (lang_hooks.finish)
- (*lang_hooks.finish) ();
+ (*lang_hooks.finish) ();
/* Close the dump files. */
add_params (lang_independent_params, LAST_PARAM);
/* Perform language-specific options intialization. */
- if (lang_hooks.init_options)
- (*lang_hooks.init_options) ();
+ (*lang_hooks.init_options) ();
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
}
/* All command line options have been processed. */
- if (lang_hooks.post_options)
- (*lang_hooks.post_options) ();
+ (*lang_hooks.post_options) ();
if (exit_after_options)
exit (0);
int (*anon_aggr_type_p) PARAMS ((union tree_node *));
};
-/* Language-specific hooks. Can be NULL unless otherwise specified. */
+/* Language-specific hooks. See langhooks.h for defaults. */
struct lang_hooks
{
option. If this function returns a negative number, then its
absolute value is the number of command-line arguments used, but,
in addition, no language-independent option processing should be
- done for this option.
-
- This hook cannot be NULL. */
+ done for this option. */
int (*decode_option) PARAMS ((int, char **));
/* Called when all command line options have been processed. */