MINOR: use DISGUISE() everywhere we deliberately want to ignore a result
It's more generic and versatile than the previous shut_your_big_mouth_gcc()
that was used to silence annoying warnings as it's not limited to ignoring
syscalls returns only. This allows us to get rid of the aforementioned
function and the shut_your_big_mouth_gcc_int variable, that started to
look ugly in multi-threaded environments.
diff --git a/include/common/standard.h b/include/common/standard.h
index 40627b2..cf8f1f0 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -1339,19 +1339,6 @@
__attribute__((format(printf, 1, 2)))
void calltrace(char *fmt, ...);
-/* used from everywhere just to drain results we don't want to read and which
- * recent versions of gcc increasingly and annoyingly complain about.
- */
-extern int shut_your_big_mouth_gcc_int;
-
-/* used from everywhere just to drain results we don't want to read and which
- * recent versions of gcc increasingly and annoyingly complain about.
- */
-static inline void shut_your_big_mouth_gcc(int r)
-{
- shut_your_big_mouth_gcc_int = r;
-}
-
/* same as strstr() but case-insensitive */
const char *strnistr(const char *str1, int len_str1, const char *str2, int len_str2);
diff --git a/include/proto/fd.h b/include/proto/fd.h
index 8dadae8..bcf71d3 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -436,7 +436,7 @@
{
char c = 'c';
- shut_your_big_mouth_gcc(write(poller_wr_pipe[tid], &c, 1));
+ DISGUISE(write(poller_wr_pipe[tid], &c, 1));
}
diff --git a/src/debug.c b/src/debug.c
index a3b208a..c11ab54 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -263,7 +263,7 @@
chunk_reset(&trash);
chunk_appendf(&trash, "Thread %u is about to kill the process.\n", tid + 1);
ha_thread_dump_all_to_trash();
- shut_your_big_mouth_gcc(write(2, trash.area, trash.data));
+ DISGUISE(write(2, trash.area, trash.data));
for (;;)
abort();
}
diff --git a/src/frontend.c b/src/frontend.c
index 23b9c3c..099d839 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -134,7 +134,7 @@
break;
}
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
if (fe->mode == PR_MODE_HTTP)
diff --git a/src/haproxy.c b/src/haproxy.c
index df3b9a6..714a490 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -225,11 +225,6 @@
char hostname[MAX_HOSTNAME_LEN];
char localpeer[MAX_HOSTNAME_LEN];
-/* used from everywhere just to drain results we don't want to read and which
- * recent versions of gcc increasingly and annoyingly complain about.
- */
-int shut_your_big_mouth_gcc_int = 0;
-
static char **next_argv = NULL;
struct list proc_list = LIST_HEAD_INIT(proc_list);
@@ -3323,7 +3318,7 @@
char pidstr[100];
snprintf(pidstr, sizeof(pidstr), "%d\n", (int)getpid());
if (pidfd >= 0)
- shut_your_big_mouth_gcc(write(pidfd, pidstr, strlen(pidstr)));
+ DISGUISE(write(pidfd, pidstr, strlen(pidstr)));
}
/* the father launches the required number of processes */
@@ -3344,7 +3339,7 @@
if (pidfd >= 0 && !(global.mode & MODE_MWORKER)) {
char pidstr[100];
snprintf(pidstr, sizeof(pidstr), "%d\n", ret);
- shut_your_big_mouth_gcc(write(pidfd, pidstr, strlen(pidstr)));
+ DISGUISE(write(pidfd, pidstr, strlen(pidstr)));
}
if (global.mode & MODE_MWORKER) {
struct mworker_proc *child;
diff --git a/src/http_ana.c b/src/http_ana.c
index 88f7937..f5a5d0d 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4973,7 +4973,7 @@
chunk_memcat(&trash, HTX_SL_P3_PTR(sl), max);
trash.area[trash.data++] = '\n';
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
/*
@@ -5000,7 +5000,7 @@
chunk_memcat(&trash, v.ptr, max);
trash.area[trash.data++] = '\n';
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
/* Allocate a new HTTP transaction for stream <s> unless there is one already.
diff --git a/src/stream.c b/src/stream.c
index 7b63f1d..c059a7a 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2300,7 +2300,7 @@
s->uniq_id, s->be->id,
objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
if (si_f->state == SI_ST_CLO &&
@@ -2309,7 +2309,7 @@
s->uniq_id, s->be->id,
objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
}
@@ -2376,7 +2376,7 @@
s->uniq_id, s->be->id,
objt_cs(si_f->end) ? (unsigned short)objt_cs(si_f->end)->conn->handle.fd : -1,
objt_cs(si_b->end) ? (unsigned short)objt_cs(si_b->end)->conn->handle.fd : -1);
- shut_your_big_mouth_gcc(write(1, trash.area, trash.data));
+ DISGUISE(write(1, trash.area, trash.data));
}
s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);