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

Lines changed: 5 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy