> I am however completely missing the point of this langhook and doc is not
> exactly informative either:
>
> /* Returns nonzero if we are in the global binding level. Ada
> returns -1 for an undocumented reason used in stor-layout.c. */
>
> What is the purpose of this hook?
I've seen things far more undocumented in GCC than this one ;-)
tree
variable_size (tree size)
{
[...]
/* If the language-processor is to take responsibility for variable-sized
items (e.g., languages which have elaboration procedures like Ada),
just return SIZE unchanged. */
if (lang_hooks.decls.global_bindings_p () < 0)
return size;
[...]
if (lang_hooks.decls.global_bindings_p ())
{
if (TREE_CONSTANT (size))
error ("type size can%'t be explicitly evaluated");
else
error ("variable-size type declared outside of any function");
return size_one_node;
}
[...]
}
In Ada there are variable-sized types at global level so it isn't an error to
call variable_size when lang_hooks.decls.global_bindings_p returns non-zero.
--
Eric Botcazou