aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-13 21:08:37 +0200
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-15 19:33:47 +0200
commite9406c09a3212ab3f120412a6bbdacb0cdd25deb (patch)
tree237b1fb0eb9196a7184b118ca4444f1e68b44536 /tccgen.c
parent47abdbd3d52a0bf92e907c3e059b5136c140fec2 (diff)
downloadtinycc-e9406c09a3212ab3f120412a6bbdacb0cdd25deb.tar.gz
tinycc-e9406c09a3212ab3f120412a6bbdacb0cdd25deb.tar.bz2
Complain for static fct declared w/o file scope
Error out on static function without file scope and give an explaination to the user
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 8af8f69..a48ca2b 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2985,6 +2985,9 @@ static void post_type(CType *type, AttributeDef *ad)
if (tok == '(') {
/* function declaration */
+ if ((type->t & VT_STATIC) && local_stack) {
+ error("Function without file scope cannot be static");
+ }
next();
l = 0;
first = NULL;