From: Willy Tarreau Date: Fri, 28 Jan 2022 08:16:47 +0000 (+0100) Subject: BUILD: checks: fix inlining issue on set_srv_agent_[addr,port} X-Git-Tag: v2.6-dev1~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95d3eaff363fb647b11cf332574079da98cf2ad8;p=thirdparty%2Fhaproxy.git BUILD: checks: fix inlining issue on set_srv_agent_[addr,port} These functions are declared as external functions in check.h and as inline functions in check.c. Let's move them as static inline in check.h. This appeared in 2.4 with the following commits: 4858fb2e1 ("MEDIUM: check: align agentaddr and agentport behaviour") 1c921cd74 ("BUG/MINOR: check: consitent way to set agentaddr") While harmless (it only triggers build warnings with some gcc 4.x), it should probably be backported where the paches above are present to keep the code consistent. --- diff --git a/include/haproxy/check.h b/include/haproxy/check.h index fdc447150d..8a7c8dc64d 100644 --- a/include/haproxy/check.h +++ b/include/haproxy/check.h @@ -90,8 +90,20 @@ int spoe_prepare_healthcheck_request(char **req, int *len); int spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen); int set_srv_agent_send(struct server *srv, const char *send); -void set_srv_agent_addr(struct server *srv, struct sockaddr_storage *sk); -void set_srv_agent_port(struct server *srv, int port); + +/* set agent addr and appropriate flag */ +static inline void set_srv_agent_addr(struct server *srv, struct sockaddr_storage *sk) +{ + srv->agent.addr = *sk; + srv->flags |= SRV_F_AGENTADDR; +} + +/* set agent port and appropriate flag */ +static inline void set_srv_agent_port(struct server *srv, int port) +{ + srv->agent.port = port; + srv->flags |= SRV_F_AGENTPORT; +} /* Use this one only. This inline version only ensures that we don't * call the function when the observe mode is disabled. diff --git a/src/check.c b/src/check.c index f0ae81504d..cb1be9b91d 100644 --- a/src/check.c +++ b/src/check.c @@ -1983,20 +1983,6 @@ int set_srv_agent_send(struct server *srv, const char *send) return 0; } -/* set agent addr and appropriate flag */ -inline void set_srv_agent_addr(struct server *srv, struct sockaddr_storage *sk) -{ - srv->agent.addr = *sk; - srv->flags |= SRV_F_AGENTADDR; -} - -/* set agent port and appropriate flag */ -inline void set_srv_agent_port(struct server *srv, int port) -{ - srv->agent.port = port; - srv->flags |= SRV_F_AGENTPORT; -} - /* Parse the "agent-send" server keyword */ static int srv_parse_agent_send(char **args, int *cur_arg, struct proxy *curpx, struct server *srv, char **errmsg)