From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: [PATCH 13/28] cppcheck: Use inline suppression for ffsl() Date: Wed, 28 Sep 2022 14:33:24 +1000 Message-ID: <20220928043339.613538-14-david@gibson.dropbear.id.au> In-Reply-To: <20220928043339.613538-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5350176331674680612==" --===============5350176331674680612== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit We define our own ffsl() as a weak symbol, in case our C library doesn't include it. On glibc systems which *do* include it, this causes a cppcheck warning because unsurprisingly our version doesn't pick the same argument names. Convert the suppression for this into an inline suppression. Signed-off-by: David Gibson --- Makefile | 2 -- util.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e0933f3..d5bfce4 100644 --- a/Makefile +++ b/Makefile @@ -290,7 +290,6 @@ cppcheck: $(SRCS) $(HEADERS) --suppress=strtokCalled:conf.c --suppress=strtokCalled:qrap.c \ --suppress=localtimeCalled:pcap.c \ --suppress=unusedStructMember:pcap.c \ - --suppress=funcArgNamesDifferent:util.h \ --suppress=unusedStructMember:dhcp.c \ \ --suppress=unmatchedSuppression:conf.c \ @@ -300,6 +299,5 @@ cppcheck: $(SRCS) $(HEADERS) --suppress=unmatchedSuppression:tcp.c \ --suppress=unmatchedSuppression:udp.c \ --suppress=unmatchedSuppression:util.c \ - --suppress=unmatchedSuppression:util.h \ $(filter -D%,$(FLAGS) $(CFLAGS)) \ . diff --git a/util.h b/util.h index 1003303..0c3c994 100644 --- a/util.h +++ b/util.h @@ -217,6 +217,7 @@ struct ipv6_opt_hdr { */ } __attribute__((packed)); /* required for some archs */ +/* cppcheck-suppress funcArgNamesDifferent */ __attribute__ ((weak)) int ffsl(long int i) { return __builtin_ffsl(i); } void __openlog(const char *ident, int option, int facility); void passt_vsyslog(int pri, const char *format, va_list ap); -- 2.37.3 --===============5350176331674680612==--