STR-381: gcc-4.0.1 invalid storage class for function
javaswul-type-annotator.c: In function ‘swul_to_swing_0_0’:
javaswul-type-annotator.c:3287: error: invalid storage class for function ‘u_48’
javaswul-type-annotator.c:3289: error: invalid storage class for function ‘u_48’
javaswul-type-annotator.c:3321: error: invalid storage class for function ‘v_48’
javaswul-type-annotator.c:3323: error: invalid storage class for function ‘v_48’
javaswul-type-annotator.c:3355: error: invalid storage class for function ‘w_48’
etc…line 3287: static ATerm u_47 (ATerm t);
Submitted on 29 July 2005 at 09:28
Issue Log
STR-381, rbvermaa:
This is because function prototype declarations in nested scopes are
no longer accepted. The fix is to remove redundant declarations, or
to move non-redundant ones to the top level.(taken from http://lkml.org/lkml/2005/6/12/61)
STR-381, martin:
Links:“A nested function always has no linkage. Declaring one with extern or static is erroneous. If you need to declare the nested function before its definition, use auto (which is otherwise meaningless for function declarations).”
STR-381, martin:
Example code:#include <stdio.h>
int foo(int x)
{
auto int g(int);
auto int f(int);int f(int y)
{
return g(y + 1);
};int g(int y)
{
return y + 1;
};return f(x);
}int main(int argc, char* argv[])
{
fprintf(stdout, "%i
", foo(5));
}
STR-381, visser:
Should be resolved by use of auto instead of static for nested functions
Log in to post comments