aboutsummaryrefslogtreecommitdiff
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>2011-02-06 22:50:05 +0100
commitcf36410e30b3c18be6c556158b2d0d0938f5b77d (patch)
tree678f0c6560e944f97ef62292ace1d1b595d33274
parent3b4b3b75a6befc521fbb4b9cb54e8131c1c35811 (diff)
downloadtinycc-cf36410e30b3c18be6c556158b2d0d0938f5b77d.tar.gz
tinycc-cf36410e30b3c18be6c556158b2d0d0938f5b77d.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 This is a rewrite of e9406c09a3212ab3f120412a6bbdacb0cdd25deb but considering problems raised about static local function pointers in 632ee5a54076d417971ae7fa8a0c154441a71499.
-rw-r--r--tccgen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 7144ccd..8464e64 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -5423,6 +5423,10 @@ ST_FUNC void decl(int l)
while (1) { /* iterate thru each declaration */
type = btype;
type_decl(&type, &ad, &v, TYPE_DIRECT);
+ if (((type.t & (VT_STATIC|VT_FUNC)) == (VT_STATIC|VT_FUNC))
+ && (l == VT_LOCAL)) {
+ error("Function without file scope cannot be static");
+ }
#if 0
{
char buf[500];