[PATCH 2/6] do not accept comma expressions in array declarator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Comma expressions are not allowed for the size in an array
declarator.

So, change the parsing of these expressions to only accept
assignment-expressions.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 parse.c                                | 2 +-
 validation/abstract-array-declarator.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/parse.c b/parse.c
index cc5dbd522b3e..182f4ad30b9c 100644
--- a/parse.c
+++ b/parse.c
@@ -1743,7 +1743,7 @@ static struct token *abstract_array_declarator(struct token *token, struct symbo
 
 	if (match_idents(token, &restrict_ident, &__restrict_ident, &__restrict___ident, NULL))
 		token = abstract_array_static_declarator(token->next, &has_static);
-	token = parse_expression(token, &expr);
+	token = assignment_expression(token, &expr);
 	sym->array_size = expr;
 	return token;
 }
diff --git a/validation/abstract-array-declarator.c b/validation/abstract-array-declarator.c
index f230e5862ae9..ca182373b866 100644
--- a/validation/abstract-array-declarator.c
+++ b/validation/abstract-array-declarator.c
@@ -3,7 +3,6 @@ void c99(int a[(1, 2)]);
 
 /*
  * check-name: abstract-array-declarator
- * check-known-to-fail
  *
  * check-error-start
 abstract-array-declarator.c:1:17: error: Expected ] in abstract_array_declarator
-- 
2.27.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux