mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
Readd lost error on local static function decls
see testcase: block scope decls for functions can't use static
(allowed is only extern or none). This got lost in commit 85690480
.
This commit is contained in:
parent
6cb68c3a17
commit
b476a5f478
2
tccgen.c
2
tccgen.c
@ -7859,6 +7859,8 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym)
|
||||
}
|
||||
#endif
|
||||
if ((type.t & VT_BTYPE) == VT_FUNC) {
|
||||
if ((type.t & VT_STATIC) && (l == VT_LOCAL))
|
||||
tcc_error("function without file scope cannot be static");
|
||||
/* if old style function prototype, we accept a
|
||||
declaration list */
|
||||
sym = type.ref;
|
||||
|
@ -216,14 +216,15 @@ int x[3];
|
||||
|| defined test_func_2 \
|
||||
|| defined test_func_3 \
|
||||
|| defined test_func_4 \
|
||||
|| defined test_func_5
|
||||
|| defined test_func_5 \
|
||||
|| defined test_func_6
|
||||
#if defined test_func_1
|
||||
int hello(int);
|
||||
#elif defined test_func_4
|
||||
static int hello(int);
|
||||
#endif
|
||||
int main () {
|
||||
#if defined test_func_5
|
||||
#if defined test_func_6
|
||||
static
|
||||
#endif
|
||||
int hello(int);
|
||||
|
@ -111,14 +111,17 @@ hello: a = 123
|
||||
hello: a = 123
|
||||
|
||||
[test_func_3]
|
||||
60_errors_and_warnings.c:241: warning: static storage ignored for redefinition of 'hello'
|
||||
60_errors_and_warnings.c:242: warning: static storage ignored for redefinition of 'hello'
|
||||
hello: a = 123
|
||||
|
||||
[test_func_4]
|
||||
hello: a = 123
|
||||
|
||||
[test_func_5]
|
||||
60_errors_and_warnings.c:241: error: incompatible types for redefinition of 'hello'
|
||||
60_errors_and_warnings.c:242: error: incompatible types for redefinition of 'hello'
|
||||
|
||||
[test_func_6]
|
||||
60_errors_and_warnings.c:230: error: function without file scope cannot be static
|
||||
|
||||
[test_var_1]
|
||||
main : 1 ; 1
|
||||
@ -131,6 +134,6 @@ main : 2 ; 2
|
||||
bar : 3 ; 3
|
||||
|
||||
[test_var_3]
|
||||
60_errors_and_warnings.c:273: error: incompatible types for redefinition of 'xxx'
|
||||
60_errors_and_warnings.c:274: error: incompatible types for redefinition of 'xxx'
|
||||
|
||||
[test_var_4]
|
||||
|
Loading…
Reference in New Issue
Block a user