Static nested functions

Joseph S. Myers joseph@codesourcery.com
Wed Dec 1 11:05:00 GMT 2004


On Tue, 30 Nov 2004, Zack Weinberg wrote:

> Suggest trying csc_extern instead of csc_auto; that might get more
> sensible error-recovery behavior.

I'd concur, and also add that this should make the code in pushdecl

  /* Similarly, a declaration of a function with static linkage at
     block scope must be checked against any existing declaration
     of that function at file scope.  */
  else if (TREE_CODE (x) == FUNCTION_DECL && scope != file_scope
           && !TREE_PUBLIC (x) && !DECL_INITIAL (x))
    {
      ...

unreachable, so it should be replaced by an assert (with appropriate tests 
for static declarations at block scope with extern and static ones at file 
scope, and for auto declarations at block scope which should shadow outer 
static or extern declarations with the same name, and that auto 
declarations or nested function definitions with implied auto conflict 
with extern declarations at the same scope but not with other auto 
declarations at the same scope).  (Only at this stage if there's a 
regression involved, of course.)

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list