On Fri, Jun 07, 2024 at 08:49:40PM +0200, Stefano Brivio wrote: > On Thu, 6 Jun 2024 20:09:43 +1000 > David Gibson wrote: > > > We have several functions which are used as callbacks for NS_CALL() which > > only read their void * parameter, they don't write it. The new > > constParameterCallback warning in cppcheck 2.14.1 complains that this > > parameter could be const void *, also pointing out that that would require > > casting the function pointer when used as a callback. > > > > Casting the function pointers seems substantially uglier than using a > > non-const void * as the parameter, especially since in each case we cast > > the void * to a const pointer of specific type immediately. So, suppress > > that error from cppcheck. > > > > Signed-off-by: David Gibson > > --- > > Makefile | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/Makefile b/Makefile > > index 8ea17576..22f05813 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -314,5 +314,6 @@ cppcheck: $(SRCS) $(HEADERS) > > $(SYSTEM_INCLUDES:%=--suppress=unmatchedSuppression:%/*) \ > > --inline-suppr \ > > --suppress=unusedStructMember \ > > + --suppress=constParameterCallback \ > > On versions before 2.14, this now raises an unmatchedSuppression... I'm > not sure how to deal with this. Should we give up and just add a > --suppress=unmatchedSuppression for all the source files? I can't think > of anything better at the moment. No, I don't think we want to do that, that's likely to leave stale suppressions about. Although it logically makes sense to suppress this globally, there are only three spots it actually occurs, so I'll rewrite to suppress in just those places, along with a similarly local unmatchedSuppression suppression. > I applied the rest of the series, just not this patch. Nice.. although this was the only one actually blocking other work. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson