mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-04 03:02:07 +00:00
BUILD: connections: shut up gcc about impossible out-of-bounds warning
Since commit 88698d9
("MEDIUM: connections: Add a way to control the
number of idling connections.") when building without threads, gcc
complains that the operations made on the idle_orphan_conns[] list is
out of bounds, which is always false since 1) <i> can only equal zero,
and 2) given it's equal to <tid> we never even enter the loop. But as
usual it thinks it knows better, so let's mask the origin of this <i>
value to shut it up. Another solution consists in making <i> unsigned
and adding an explicit range check.
This commit is contained in:
parent
9c218e7521
commit
08e2b41e81
@ -1354,6 +1354,13 @@ int connect_server(struct stream *s)
|
|||||||
for (i = 0; i < global.nbthread; i++) {
|
for (i = 0; i < global.nbthread; i++) {
|
||||||
if (i == tid)
|
if (i == tid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// just silence stupid gcc which reports an absurd
|
||||||
|
// out-of-bounds warning for <i> which is always
|
||||||
|
// exactly zero without threads, but it seems to
|
||||||
|
// see it possibly larger.
|
||||||
|
ALREADY_CHECKED(i);
|
||||||
|
|
||||||
tokill_conn = LIST_POP_LOCKED(&srv->idle_orphan_conns[i],
|
tokill_conn = LIST_POP_LOCKED(&srv->idle_orphan_conns[i],
|
||||||
struct connection *, list);
|
struct connection *, list);
|
||||||
if (tokill_conn) {
|
if (tokill_conn) {
|
||||||
|
Loading…
Reference in New Issue
Block a user