From cd5ede17e535a21414c455e54dc1baef9c3f34b8 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Wed, 17 Feb 2021 10:07:27 +0100 Subject: Silence unused-but-set-variable warnings When ipset is compiled in non-debug mode, in some environments warnings treated as errors emitted: session.c: In function 'build_msg': session.c:1985:28: warning: variable 'type' set but not used [-Wunused-but-set-variable] const struct ipset_type *type; ^ session.c:2030:28: warning: variable 'type' set but not used [-Wunused-but-set-variable] const struct ipset_type *type; ^ Fix it by hiding the unused variable definitions/settings in non-debug mode. Reported by Serhey Popovych. Signed-off-by: Jozsef Kadlecsik --- lib/session.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/session.c b/lib/session.c index b088bc8..1ca26ff 100644 --- a/lib/session.c +++ b/lib/session.c @@ -1982,7 +1982,7 @@ build_msg(struct ipset_session *session, bool aggregate) break; case IPSET_CMD_ADD: case IPSET_CMD_DEL: { - const struct ipset_type *type; + DD(const struct ipset_type *type); if (!aggregate) { /* Setname, type not checked/added yet */ @@ -2007,7 +2007,7 @@ build_msg(struct ipset_session *session, bool aggregate) open_nested(session, nlh, IPSET_ATTR_ADT); } } - type = ipset_data_get(data, IPSET_OPT_TYPE); + DD(type = ipset_data_get(data, IPSET_OPT_TYPE)); D("family: %u, type family %u", ipset_data_family(data), type->family); if (open_nested(session, nlh, IPSET_ATTR_DATA)) { @@ -2027,7 +2027,7 @@ build_msg(struct ipset_session *session, bool aggregate) break; } case IPSET_CMD_TEST: { - const struct ipset_type *type; + DD(const struct ipset_type *type); /* Return codes are not aggregated, so tests cannot be either */ /* Setname, type not checked/added yet */ @@ -2040,7 +2040,7 @@ build_msg(struct ipset_session *session, bool aggregate) return ipset_err(session, "Invalid test command: missing settype"); - type = ipset_data_get(data, IPSET_OPT_TYPE); + DD(type = ipset_data_get(data, IPSET_OPT_TYPE)); D("family: %u, type family %u", ipset_data_family(data), type->family); ADDATTR_SETNAME(session, nlh, data); -- cgit v1.2.3