On a piece of code in C++ and nested functions

Steven Bosscher s.bosscher@student.tudelft.nl
Mon Sep 15 13:53:00 GMT 2003


Hi,

In cp/decl.c, there's the following piece of code to expand nested
functions,

   979    /* Output any nested inline functions within this block
   980       if they weren't already output.  */
   981    for (decl = decls; decl; decl = TREE_CHAIN (decl))
   982      if (TREE_CODE (decl) == FUNCTION_DECL
   983          && ! TREE_ASM_WRITTEN (decl)
   984          && DECL_INITIAL (decl) != NULL_TREE
   985          && TREE_ADDRESSABLE (decl)
   986          && decl_function_context (decl) == current_function_decl)
   987        {
   988          /* If this decl was copied from a file-scope decl
   989             on account of a block-scope extern decl,
   990             propagate TREE_ADDRESSABLE to the file-scope decl.  */
   991          if (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE)
   992            TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
   993          else
   994            {
   995              push_function_context ();
   996              output_inline_function (decl);
   997              pop_function_context ();
   998            }
   999        }

that hasn't been touched since revision 1.1.  The manual says that
"Nested functions are not supported for GNU C++."  So what's the purpose
of this code?  Can it be removed?

Gr.
Steven



More information about the Gcc mailing list