From d0daed5a10211a723ac23d7d6644d12744a362d4 Mon Sep 17 00:00:00 2001 From: Petr Skocik Date: Fri, 23 Mar 2018 13:19:58 +0100 Subject: [PATCH 3/4] Don't fail on const/restrict/static/* inside [] This patch makes tcc ignore them. Normally (as per the C standard), They should be only applicable inside parameter arrays and affect (const/restrict) the pointer the array gets converted to. --- tccgen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tccgen.c b/tccgen.c index 08cc5ec..3770ce3 100644 --- a/tccgen.c +++ b/tccgen.c @@ -4344,8 +4344,14 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) int saved_nocode_wanted = nocode_wanted; /* array definition */ next(); - if (tok == TOK_RESTRICT1) - next(); + for(;;){ + switch(tok){ + default: break; + case TOK_RESTRICT1: case TOK_RESTRICT2: case TOK_RESTRICT3: + case TOK_STATIC: case TOK_CONST1: case '*': + next(); continue; + }; break; + } n = -1; t1 = 0; if (tok != ']') { -- 2.15.1