From e9406c09a3212ab3f120412a6bbdacb0cdd25deb Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 13 Apr 2010 21:08:37 +0200 Subject: [PATCH] Complain for static fct declared w/o file scope Error out on static function without file scope and give an explaination to the user --- tccgen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tccgen.c b/tccgen.c index 8af8f691..a48ca2b7 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;