Hello,
I have been trying to understand the higher level structure of g++,
so I have been reading the source code. I'm not sure about some
things and asked the dev irc channel. There I was recommended to ask
them here so:
1) Is there some reason, why following language hook definitions
have not been removed from cp/cp-lang.cc:
LANG_HOOKS_CLEAR_BINDING_STACK pop_everything
LANG_HOOKS_HANDLE_FILENAME c_common_handle_filename
as they were removed in following patches:
2008-03-11 Paolo Bonzini <[email protected]>
* langhooks-def.h (LANG_HOOKS_CLEAR_BINDING_STACK): Delete.
* langhooks.h (struct lang_hooks): delete clear_binding_stack member.
* toplev.c (compile_file): Don't call it.
2003-07-31 Per Bothner <[email protected]>
* opts.c (in_fnames, num_in_fnames): Moved here from c-opts.
(add_input_filename): New function.
(handle_options): Call add_input_filename directly instead of
with a lang hook.
* opts.h (in_fnames, num_in_fnames): Moved here.
(add_input_filename): Declare.
* c-decl.c: Need to #include opts.h.
* Makefile.in (c-decl.o): Also depends on opts.h.
* c-opts.c (in_fnames, num_in_fnames): Moved to opts.c.
(c_common_handle_filename): Replaced by add_input_filename.
* c-common.h (in_fnames, num_in_fnames, c_common_handle_filename):
Remove.
* langhooks.h (struct lang_hooks): Remove handle_filename hook.
* langhooks-def.h (LANG_HOOKS_HANDLE_FILENAME): Remove macro.
(LANG_HOOKS_INITIALIZER): Remove use of LANG_HOOKS_HANDLE_FILENAME.
* c-lang.c (LANG_HOOKS_HANDLE_FILENAME): Remove macro.
2) Why macro FROB_CONTEXT in cp/cp-tree.h:
#define FROB_CONTEXT(NODE) \
((NODE) == global_namespace ? DECL_CONTEXT (NODE) : (NODE))
returns DECL_CONTEXT (NODE) if NODE is global_namespace,
as the gcc internal manual says that:
> The DECL_CONTEXT for the global_namespace is NULL_TREE
Isn't DECL_CONTEXT (NODE) redundant and could be replaced by NULL_TREE?
I assume that the answers for both is simply that, nobody just has not written
a patch removing them. However I'm not sure as there might be some
deeper reason that I'm not understanding.
--
Miro Palmu