bc: remove "error after expression parsing" check
It is misplaced: caller knows better what can or cannot follow the expression.
Sometimes even caller's caller: "if (1) return a+b else..." -
parser of "return" does not know that "else" after it is valid,
parser of stmt does not know it either, - only parser of
"if" knows it!
The removed code balked on e.g. "{ print 1 }" statement.
This does not break any valid programs, but starts accepting some
invalid ones, e.g. "print 1 print 2" would work.
function old new delta
zcommon_parse_expr 40 32 -8
zbc_parse_name 509 494 -15
zbc_parse_stmt_possibly_auto 1678 1638 -40
bc_parse_expr_empty_ok 2025 1977 -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-111) Total: -111 bytes
text data bss dec hex filename
981599 485 7296 989380 f18c4 busybox_old
981488 485 7296 989269 f1855 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -76,6 +76,11 @@ testing "bc print 1,2,3" \
|
||||
"123" \
|
||||
"" "print 1,2,3"
|
||||
|
||||
testing "bc { print 1 }" \
|
||||
"bc" \
|
||||
"1" \
|
||||
"" "{ print 1 }"
|
||||
|
||||
testing "bc nested loops and breaks" \
|
||||
"bc" \
|
||||
"\
|
||||
|
||||
Reference in New Issue
Block a user