Message ID | 08178d03-1912-76e7-0733-75e8f1d691af@simtreas.ru (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Herbert Xu |
Headers | show |
Series | : allow $(()) | expand |
On Fri, Jan 29, 2021 at 11:49:20PM +0400, Vladimir N. Oleynik wrote: > > My micro patch for allow $(( )) as 0 Thanks but we don't add features that are not required by POSIX.
--- arith_yacc.orig.c 2020-12-23 11:58:12.000000000 +0400 +++ arith_yacc.c 2021-01-29 23:47:01.854997852 +0400 @@ -292,10 +292,17 @@ intmax_t arith(const char *s) { intmax_t result; + int l0; arith_buf = arith_startbuf = s; - result = assignment(yylex(), 0); + l0 = yylex(); + if (l0 == 0) { + /* $(( )) */ + yylval.val = 0; + l0 = ARITH_NUM; + } + result = assignment(l0, 0); if (last_token) yyerror("expecting EOF");