dc: without -x, do not parse extended regs: 's p' means: store to ' ' reg, print

function                                             old     new   delta
zbc_lex_next                                        2240    2233      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-7)               Total: -7 bytes
   text	   data	    bss	    dec	    hex	filename
 981437	    485	   7296	 989218	  f1822	busybox_old
 981412	    485	   7296	 989193	  f1809	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-12-24 01:53:55 +01:00
parent 73b2c60825
commit 81293c8af0

View File

@ -3352,16 +3352,13 @@ static BC_STATUS zbc_lex_token(BcLex *l)
#if ENABLE_DC #if ENABLE_DC
static BC_STATUS zdc_lex_register(BcLex *l) static BC_STATUS zdc_lex_register(BcLex *l)
{ {
if (isspace(l->buf[l->i - 1])) { if (G_exreg && isspace(l->buf[l->i])) {
bc_lex_whitespace(l); bc_lex_whitespace(l); // eats whitespace (but not newline)
++l->i; l->i++; // bc_lex_name() expects this
if (!G_exreg)
RETURN_STATUS(bc_error("extended register"));
bc_lex_name(l); bc_lex_name(l);
} } else {
else {
bc_vec_pop_all(&l->t.v); bc_vec_pop_all(&l->t.v);
bc_vec_push(&l->t.v, &l->buf[l->i - 1]); bc_vec_push(&l->t.v, &l->buf[l->i++]);
bc_vec_pushZeroByte(&l->t.v); bc_vec_pushZeroByte(&l->t.v);
l->t.t = BC_LEX_NAME; l->t.t = BC_LEX_NAME;
} }
@ -3425,8 +3422,8 @@ static BC_STATUS zdc_lex_token(BcLex *l)
BC_LEX_STORE_PUSH, BC_LEX_STORE_PUSH,
}; };
BcStatus s = BC_STATUS_SUCCESS; BcStatus s;
char c = l->buf[l->i++], c2; char c, c2;
size_t i; size_t i;
for (i = 0; i < ARRAY_SIZE(dc_lex_regs); ++i) { for (i = 0; i < ARRAY_SIZE(dc_lex_regs); ++i) {
@ -3434,6 +3431,8 @@ static BC_STATUS zdc_lex_token(BcLex *l)
RETURN_STATUS(zdc_lex_register(l)); RETURN_STATUS(zdc_lex_register(l));
} }
s = BC_STATUS_SUCCESS;
c = l->buf[l->i++];
if (c >= '%' && c <= '~' if (c >= '%' && c <= '~'
&& (l->t.t = dc_char_to_LEX[c - '%']) != BC_LEX_INVALID && (l->t.t = dc_char_to_LEX[c - '%']) != BC_LEX_INVALID
) { ) {
@ -3462,7 +3461,7 @@ static BC_STATUS zdc_lex_token(BcLex *l)
case '\f': case '\f':
case '\r': case '\r':
case ' ': case ' ':
l->newline = (c == '\n'); l->newline = 0; // was (c == '\n')
bc_lex_whitespace(l); bc_lex_whitespace(l);
break; break;
case '!': case '!':