From: Richard Stallman Date: Sat, 27 Feb 1993 19:08:53 +0000 (+0000) Subject: (pushdecl): Nested fn decl gets DECL_CONTEXT iff not extern. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=89d7540d7bd16a0b664be710db1159f5e8763572;p=gcc.git (pushdecl): Nested fn decl gets DECL_CONTEXT iff not extern. (grokdeclarator): Make `long long' work even with -pedantic, despite the warning. (declare_parm_level): Unconditionally store 1. (pushdecl): Criterion for no warning is, next level up is a parm level. From-SVN: r3555 --- diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4ff5f3e71ad..60454762d0c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -318,7 +318,6 @@ struct binding_level struct binding_level *level_chain; /* Nonzero for the level that holds the parameters of a function. */ - /* 2 for a definition, 1 for a declaration. */ char parm_flag; /* Nonzero if this level "doesn't exist" for tags. */ @@ -740,13 +739,15 @@ kept_level_p () } /* Identify this binding level as a level of parameters. - DEFINITION_FLAG is 1 for a definition, 0 for a declaration. */ + DEFINITION_FLAG is 1 for a definition, 0 for a declaration. + But it turns out there is no way to pass the right value for + DEFINITION_FLAG, so we ignore it. */ void declare_parm_level (definition_flag) int definition_flag; { - current_binding_level->parm_flag = 1 + definition_flag; + current_binding_level->parm_flag = 1; } /* Nonzero if currently making parm declarations. */ @@ -1718,8 +1719,11 @@ pushdecl (x) register struct binding_level *b = current_binding_level; DECL_CONTEXT (x) = current_function_decl; - /* A local declaration for a function doesn't constitute nesting. */ - if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0) + /* A local extern declaration for a function doesn't constitute nesting. + A local auto declaration does, since it's a forward decl + for a nested function coming later. */ + if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0 + && DECL_EXTERNAL (x)) DECL_CONTEXT (x) = 0; if (warn_nested_externs && DECL_EXTERNAL (x) && b != global_binding_level @@ -2072,8 +2076,12 @@ pushdecl (x) char *warnstring = 0; if (TREE_CODE (x) == PARM_DECL - && current_binding_level->parm_flag == 1) - /* Don't warn about the parm names in a declaration. */ + && current_binding_level->level_chain->parm_flag) + /* Don't warn about the parm names in function declarator + within a function declarator. + It would be nice to avoid warning in any function + declarator in a declaration, as opposed to a definition, + but there is no way to tell it's not a definition. */ ; else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL) warnstring = "declaration of `%s' shadows a parameter"; @@ -3693,12 +3701,14 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) { if (i == (int) RID_LONG && specbits & (1<