From 968c8688c49dc62eca51f6b6a00087246c2bb1eb Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 28 May 2011 13:39:18 +0200 Subject: [PATCH] widl: Array dimensions have to be constants. --- dlls/rpcrt4/tests/server.idl | 2 +- tools/widl/parser.y | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index 2605c1232f9..56bf1a55df3 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -157,7 +157,7 @@ cpp_quote("#endif") int sum_cs(cs_t *cs); int sum_cps(cps_t *cps); int sum_cpsc(cpsc_t *cpsc); - int sum_complex_array(int n, refpint_t pi[n]); + int sum_complex_array(int n, [size_is(n)] refpint_t pi[]); typedef [wire_marshal(int)] void *puint_t; int square_puint(puint_t p); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index fc1076f2cf2..6f0cf8c9fb4 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -452,8 +452,12 @@ arg: attributes decl_spec m_any_declarator { if ($2->stgclass != STG_NONE && $ } ; -array: '[' m_expr ']' { $$ = $2; } +array: '[' expr ']' { $$ = $2; + if (!$$->is_const) + error_loc("array dimension is not an integer constant\n"); + } | '[' '*' ']' { $$ = make_expr(EXPR_VOID); } + | '[' ']' { $$ = make_expr(EXPR_VOID); } ; m_attributes: { $$ = NULL; } @@ -638,16 +642,6 @@ m_exprs: m_expr { $$ = append_expr( NULL, $1 ); | m_exprs ',' m_expr { $$ = append_expr( $1, $3 ); } ; -/* -exprs: { $$ = make_expr(EXPR_VOID); } - | expr_list - ; - -expr_list: expr - | expr_list ',' expr { LINK($3, $1); $$ = $3; } - ; -*/ - m_expr: { $$ = make_expr(EXPR_VOID); } | expr ;