This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static nested functions


"Joseph S. Myers" <joseph@codesourcery.com> writes:

> 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

good point ...

> (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).

I can't parse this sentence; is it just a list of appropriate tests?
If so, would you be willing to implement such a test and file a 4.1-
target PR?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]