From: Thomas Preud'homme <thomas.preudhomme@celest.fr>
Date: Tue, 13 Apr 2010 21:08:37 +0200
Subject: Error out when declaring a static function without file scope
Error out when declaring a static function in another scope than file scope, as
required by C99 6.2.2:21
Origin: vendor
Bug-Debian: http://bugs.debian.org/170105
Forwarded: http://lists.nongnu.org/archive/html/tinycc-devel/2010-04/msg00041.html
Reviewed-by: grischka <grishka@gmx.de>
Last-Update: 2010-04-20
Applied-Upstream: commit: e9406c09a3212ab3f120412a6bbdacb0cdd25deb
---
tccgen.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tccgen.c b/tccgen.c
index 5fa9f43..94d9c11 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2688,6 +2688,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;
--