Hi!
This is something we've been discussing on IRC today. DECL_NO_STATIC_CHAIN
is ATM quite weird, C++/Ada FEs set it to 1 for new function decls, C leaves
it at the default 0, then tree-nested computes it, but before my
cgraph_lower_function patch committed today it has been only valid for
decl_function_context (fndecl) != NULL functions.
This patch changes it to DECL_STATIC_CHAIN, which defaults to 0 and just
tree-nested.c sets it on nested functions that need a static chain.
This worked for everything except gcc.dg/nested-fn-2.c, where
initializer_constant_valid_p is called by C FE and expects all C nested
fns to be rejected (but not C++, ...). That's before tree-nested.c does its
job, so I had to change c-parser to also set DECL_STATIC_CHAIN on nested
functions.
if (dump_file
&& (dump_flags & TDF_DETAILS)
- && DECL_NO_STATIC_CHAIN (info->context))
- fprintf (dump_file, "Resetting no-static-chain for %s\n",
+ && !DECL_STATIC_CHAIN (info->context))
+ fprintf (dump_file, "Resetting static-chain for %s\n",
lang_hooks.decl_printable_name (info->context, 2));