From ae351311da0d4e6642f746ae4a9c9a60f83e1e25 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 10 Jul 2023 11:13:51 +0200 Subject: ash: remove "volatile" specifier from suppress_int function old new delta aliascmd 274 278 +4 signal_handler 81 80 -1 static.redirectsafe 144 141 -3 unwindlocalvars 219 215 -4 trapcmd 333 329 -4 setvar 164 160 -4 setpwd 167 163 -4 setinputfile 216 212 -4 setcmd 76 72 -4 readcmd 221 217 -4 raise_exception 26 22 -4 out2str 37 33 -4 out1str 32 28 -4 freejob 89 85 -4 forkchild 616 612 -4 fg_bgcmd 298 294 -4 expandarg 949 945 -4 evaltree 753 749 -4 evalsubshell 173 169 -4 evalpipe 346 342 -4 evalfun 408 404 -4 cdcmd 699 695 -4 ash_main 1240 1236 -4 __pgetc 589 585 -4 unaliascmd 152 147 -5 unalias 51 46 -5 umaskcmd 253 248 -5 stalloc 97 92 -5 shiftcmd 144 139 -5 setinputstring 73 68 -5 redirect 1068 1063 -5 recordregion 81 76 -5 pushstring 160 155 -5 popstring 120 115 -5 popstackmark 69 64 -5 popredir 123 118 -5 popfile 110 105 -5 out1fmt 45 40 -5 newline_and_flush 39 34 -5 ifsfree 66 61 -5 growstackblock 146 141 -5 freestrings 95 90 -5 fmtstr 59 54 -5 flush_stdout_stderr 23 18 -5 dowait 577 572 -5 delete_cmd_entry 52 47 -5 clearcmdentry 98 93 -5 ash_arith 79 74 -5 argstr 1404 1399 -5 evalcommand 1523 1515 -8 removerecordregions 219 209 -10 mklocal 284 274 -10 find_command 893 883 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/52 up/down: 4/-251) Total: -247 bytes Signed-off-by: Denys Vlasenko --- shell/ash.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index e154cc6cc..1764b43c9 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -424,7 +424,11 @@ struct globals_misc { struct jmploc *exception_handler; - volatile int suppress_int; /* counter */ + /*volatile*/ int suppress_int; /* counter */ + /* ^^^^^^^ removed "volatile" since gcc would turn suppress_int++ into ridiculouls + * 3-insn sequence otherwise. + * We don't change suppress_int asyncronously (in a signal handler), but we do read it async. + */ volatile /*sig_atomic_t*/ smallint pending_int; /* 1 = got SIGINT */ volatile /*sig_atomic_t*/ smallint got_sigchld; /* 1 = got SIGCHLD */ volatile /*sig_atomic_t*/ smallint pending_sig; /* last pending signal */ @@ -717,7 +721,8 @@ int_on(void) { barrier(); if (--suppress_int == 0 && pending_int) - raise_interrupt(); + raise_interrupt(); /* does not return */ + barrier(); } #if DEBUG_INTONOFF # define INT_ON do { \ @@ -733,7 +738,8 @@ force_int_on(void) barrier(); suppress_int = 0; if (pending_int) - raise_interrupt(); + raise_interrupt(); /* does not return */ + barrier(); } #define FORCE_INT_ON force_int_on() @@ -743,7 +749,8 @@ force_int_on(void) barrier(); \ suppress_int = (v); \ if (suppress_int == 0 && pending_int) \ - raise_interrupt(); \ + raise_interrupt(); /* does not return */ \ + barrier(); \ } while (0) -- cgit v1.2.3