public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Questions about language hooks and some macro definitions
@ 2024-03-08 21:58 Miro Palmu
  0 siblings, 0 replies; only message in thread
From: Miro Palmu @ 2024-03-08 21:58 UTC (permalink / raw)
  To: gcc

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  <bonzini@gnu.org>
   
           * 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  <pbothner@apple.com>

           * 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-08 21:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 21:58 Questions about language hooks and some macro definitions Miro Palmu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).