Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 08d1b22

Browse files
author
Michael Meskes
committed
Allow C array definitions to use sizeof().
When parsing C variable definitions ecpg should allow sizeof() operators as array dimensions.
1 parent 8ac5e88 commit 08d1b22

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/interfaces/ecpg/preproc/ecpg.trailer

+5
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,11 @@ Iresult: Iconst { $$ = $1; }
18651865
| Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
18661866
| ecpg_sconst { $$ = $1; }
18671867
| ColId { $$ = $1; }
1868+
| ColId '(' ColId ')' { if (pg_strcasecmp($1, "sizeof") != 0)
1869+
mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
1870+
else
1871+
$$ = cat_str(4,$1, mm_strdup("("), $3, mm_strdup(")"));
1872+
}
18681873
;
18691874

18701875
execute_rest: /* EMPTY */ { $$ = EMPTY; }

0 commit comments

Comments
 (0)