BUILD: threads: fix minor build warnings when threads are disabled
These potential null-deref warnings are emitted on gcc 7 and above
when threads are disabled due to the use of objt_server() after an
existing validity test. Let's switch to __objt_server() since we
know the pointer is valid, it will not confuse the compiler.
Some of these may be backported to 1.8.
diff --git a/src/cli.c b/src/cli.c
index b99270d..0fbb6f3 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2043,10 +2043,10 @@
if (objt_server(s->target)) {
if (s->flags & SF_CURR_SESS) {
s->flags &= ~SF_CURR_SESS;
- HA_ATOMIC_SUB(&objt_server(s->target)->cur_sess, 1);
+ HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
}
- if (may_dequeue_tasks(objt_server(s->target), be))
- process_srv_queue(objt_server(s->target));
+ if (may_dequeue_tasks(__objt_server(s->target), be))
+ process_srv_queue(__objt_server(s->target));
}
s->target = NULL;
diff --git a/src/proto_http.c b/src/proto_http.c
index 0f8bc22..e2f3009 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -3828,7 +3828,7 @@
if (objt_server(s->target)) {
if (s->flags & SF_CURR_SESS) {
s->flags &= ~SF_CURR_SESS;
- HA_ATOMIC_SUB(&objt_server(s->target)->cur_sess, 1);
+ HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
}
if (may_dequeue_tasks(objt_server(s->target), be))
process_srv_queue(objt_server(s->target));
@@ -4650,8 +4650,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
}
abort_response:
channel_auto_close(rep);
@@ -4685,8 +4685,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
}
channel_auto_close(rep);
@@ -4721,8 +4721,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
}
channel_auto_close(rep);
@@ -4771,8 +4771,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
}
channel_auto_close(rep);
@@ -4878,9 +4878,9 @@
*/
if (objt_server(s->target)) {
if (txn->status >= 100 && (txn->status < 500 || txn->status == 501 || txn->status == 505))
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_OK);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_OK);
else
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_STS);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_STS);
}
/*
@@ -5271,8 +5271,8 @@
if (apply_filters_to_response(s, rep, rule_set) < 0) {
return_bad_resp:
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_RSP);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
}
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
return_srv_prx_502:
@@ -5687,7 +5687,7 @@
res->analysers &= AN_RES_FLT_END;
s->req.analysers &= AN_REQ_FLT_END; /* we're in data phase, we want to abort both directions */
if (objt_server(s->target))
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_PRXCOND;
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 975fd77..b6c127e 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -1478,8 +1478,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_ERROR);
}
rep->analysers &= AN_RES_FLT_END;
@@ -1509,8 +1509,8 @@
else if (rep->flags & CF_READ_TIMEOUT) {
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
}
rep->analysers &= AN_RES_FLT_END;
@@ -1530,7 +1530,7 @@
HA_ATOMIC_ADD(&sess->fe->fe_counters.cli_aborts, 1);
HA_ATOMIC_ADD(&s->be->be_counters.cli_aborts, 1);
if (objt_server(s->target))
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.cli_aborts, 1);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.cli_aborts, 1);
rep->analysers &= AN_RES_FLT_END;
txn->status = 400;
@@ -1552,8 +1552,8 @@
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
}
rep->analysers &= AN_RES_FLT_END;
@@ -1644,7 +1644,7 @@
stream_inc_http_err_ctr(s);
if (objt_server(s->target))
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.p.http.rsp[n], 1);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.p.http.rsp[n], 1);
/* Adjust server's health based on status code. Note: status codes 501
* and 505 are triggered on demand by client request, so we must not
@@ -1652,9 +1652,9 @@
*/
if (objt_server(s->target)) {
if (txn->status >= 100 && (txn->status < 500 || txn->status == 501 || txn->status == 505))
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_OK);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_OK);
else
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_STS);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_STS);
}
/*
@@ -1764,8 +1764,8 @@
return_bad_res:
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
}
txn->status = 502;
s->si[1].flags |= SI_FL_NOLINGER;
@@ -1885,7 +1885,7 @@
/* has the response been denied ? */
if (txn->flags & TX_SVDENY) {
if (objt_server(s->target))
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_secu, 1);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_secu, 1);
HA_ATOMIC_ADD(&s->be->be_counters.denied_resp, 1);
HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_resp, 1);
@@ -2072,8 +2072,8 @@
return_bad_resp:
if (objt_server(s->target)) {
- HA_ATOMIC_ADD(&objt_server(s->target)->counters.failed_resp, 1);
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_RSP);
+ HA_ATOMIC_ADD(&__objt_server(s->target)->counters.failed_resp, 1);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
}
HA_ATOMIC_ADD(&s->be->be_counters.failed_resp, 1);
@@ -2297,7 +2297,7 @@
res->analysers &= AN_RES_FLT_END;
s->req.analysers &= AN_REQ_FLT_END; /* we're in data phase, we want to abort both directions */
if (objt_server(s->target))
- health_adjust(objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
+ health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_HDRRSP);
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_PRXCOND;
diff --git a/src/stream.c b/src/stream.c
index 5def7f1..ed913d1 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -352,7 +352,7 @@
if (objt_server(s->target)) { /* there may be requests left pending in queue */
if (s->flags & SF_CURR_SESS) {
s->flags &= ~SF_CURR_SESS;
- HA_ATOMIC_SUB(&objt_server(s->target)->cur_sess, 1);
+ HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
}
if (may_dequeue_tasks(objt_server(s->target), s->be))
process_srv_queue(objt_server(s->target));
@@ -713,7 +713,7 @@
if (s->flags & SF_CURR_SESS) {
s->flags &= ~SF_CURR_SESS;
- HA_ATOMIC_SUB(&objt_server(s->target)->cur_sess, 1);
+ HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
}
if ((si->flags & SI_FL_ERR) &&