Skip to content
Snippets Groups Projects
Commit 08d1b22b authored by Michael Meskes's avatar Michael Meskes
Browse files

Allow C array definitions to use sizeof().

When parsing C variable definitions ecpg should allow sizeof() operators as array dimensions.
parent 8ac5e88f
No related branches found
No related tags found
No related merge requests found
...@@ -1865,6 +1865,11 @@ Iresult: Iconst { $$ = $1; } ...@@ -1865,6 +1865,11 @@ Iresult: Iconst { $$ = $1; }
| Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); } | Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
| ecpg_sconst { $$ = $1; } | ecpg_sconst { $$ = $1; }
| ColId { $$ = $1; } | ColId { $$ = $1; }
| ColId '(' ColId ')' { if (pg_strcasecmp($1, "sizeof") != 0)
mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
else
$$ = cat_str(4,$1, mm_strdup("("), $3, mm_strdup(")"));
}
; ;
execute_rest: /* EMPTY */ { $$ = EMPTY; } execute_rest: /* EMPTY */ { $$ = EMPTY; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment