mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-04 22:07:42 +08:00
Readd awkward unused-result dance
This was removed in 962b0f8b90884ceb68431acd8e148a6908650134, presumably with the idea that casting to void, like before, was enough. It's not, at least with gcc 11.1
This commit is contained in:
parent
e19ccc8a7a
commit
c19a6e912d
@ -135,10 +135,14 @@ static void print_ignored_signals() {
|
||||
|
||||
static void print_stop_cont() {
|
||||
signal(SIGTSTP, [](int) {
|
||||
(void)write(STDOUT_FILENO, "SIGTSTP\n", strlen("SIGTSTP\n"));
|
||||
// C++ compilers are awful and this is the dance we need to do to silence the "Unused result" warning.
|
||||
// No, casting to (void) does *not* work. Please leave this.
|
||||
auto __attribute__((unused)) _ = write(STDOUT_FILENO, "SIGTSTP\n", strlen("SIGTSTP\n"));
|
||||
kill(getpid(), SIGSTOP);
|
||||
});
|
||||
signal(SIGCONT, [](int) { (void)write(STDOUT_FILENO, "SIGCONT\n", strlen("SIGCONT\n")); });
|
||||
signal(SIGCONT, [](int) {
|
||||
auto __attribute__((unused)) _ = write(STDOUT_FILENO, "SIGCONT\n", strlen("SIGCONT\n"));
|
||||
});
|
||||
char buff[1];
|
||||
for (;;) {
|
||||
if (read(STDIN_FILENO, buff, sizeof buff) >= 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user