Since revision r15762 the function VALGRIND_PRINTF will create some code, even when NVALGRIND is defined. This is caused by using code with volatile to silence variable unused warning. VALGRIND_PRINTF(const char *format, ...) { #if defined(NVALGRIND) if (format) *(volatile const char *)format; /* avoid compiler warning */ return 0; #else /* NVALGRIND */ ... I suggest to use either simpler code to silence the variable unused warning. E.g. (void)format; But as Florian wrote, this could trigger some static analyzers. Alternatively use the gcc construct __attribute__((__unused__)) and only use the simple version if this is not supported by the compiler. One possibility is to conditionally define __attribute__ for all other compilers, so its usage is without conditionals. If you do not want to define __attribute__ for namespace pollution, there could be a valgrind specific name, maybe __vg__attribute__ that is defined the same way, and for gcc equals to __attribute__. Reproducible: Always
Created attachment 96891 [details] valgrind-improve-unused-parameter-on-r15763.patch This patch implements the __attribute__ usage. But I am not sure about the ifdef code. It is just what was originally around the __attribute__ usage.
The simplest solution could be to use "(void)format" and protect this with an ifdef checking that we are not running under the problematic static code checker.
e.g. QT has a macro like this: #define Q_UNUSED(x) (void)x; To be used inside functions: Q_UNUSED(format)
Created attachment 104809 [details] valgrind-3.12.0-valgrind_printf-simple-nvalgrind-fix-plus-testcase.patch This new patch fixes the problem in the simplest way: "(void)format;" Additionally it adds a testcase to compile and run the existing vgprintf.c with NVALGRIND
Patch valgrind-3.12.0-valgrind_printf-simple-nvalgrind-fix-plus-testcase.patch has been tested with MSVC 2008 configured to warning level 4.
Committed, r16290. Thanks for the patch.