From 93e766b3fe1ed412ce37b88c55b65500afafc64b Mon Sep 17 00:00:00 2001 From: Adeel Date: Tue, 29 Sep 2015 13:21:41 +0300 Subject: [PATCH] Deps: Mark UNUSED parameters in valgrind header. Clang on FreeBSD was complaining: ```csh [ 26%] Building C object CMakeFiles/criterion.dir/src/core/abort.c.o [ 30%] Building C object CMakeFiles/criterion.dir/src/core/report.c.o [ 30%] Building C object CMakeFiles/criterion.dir/src/core/runner.c.o In file included from /root/projects/Criterion/Criterion/Criterion/src/core/runner.c:29: /root/projects/Criterion/Criterion/Criterion/dependencies/valgrind/include/valgrind/valgrind.h:6223:29: error: unused parameter 'format' [-Werror,-Wunused-parameter] VALGRIND_PRINTF(const char *format, ...) ^ /root/projects/Criterion/Criterion/Criterion/dependencies/valgrind/include/valgrind/valgrind.h:6261:39: error: unused parameter 'format' [-Werror,-Wunused-parameter] VALGRIND_PRINTF_BACKTRACE(const char *format, ...) ^ 2 errors generated. ``` The other way to fix it was to add a compiler option in CMake: ```cmake add_compile_options(-Wno-unused-parameter) ``` but this approach disables the check globally. I am not sure whether there is a way to scope the compiler option to a subdirectory; especially in cases where submodule (via `add_subdirectory`) headers have unsed parameters. --- dependencies/valgrind/include/valgrind/valgrind.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dependencies/valgrind/include/valgrind/valgrind.h b/dependencies/valgrind/include/valgrind/valgrind.h index 6954d75..bf5620a 100644 --- a/dependencies/valgrind/include/valgrind/valgrind.h +++ b/dependencies/valgrind/include/valgrind/valgrind.h @@ -93,6 +93,7 @@ #include +#include /* Nb: this file might be included in a file compiled with -ansi. So we can't use C++ style "//" comments nor the "asm" keyword (instead @@ -6220,7 +6221,7 @@ static int #if defined(_MSC_VER) __inline #endif -VALGRIND_PRINTF(const char *format, ...) +VALGRIND_PRINTF(UNUSED const char *format, ...) { #if defined(NVALGRIND) return 0; @@ -6258,7 +6259,7 @@ static int #if defined(_MSC_VER) __inline #endif -VALGRIND_PRINTF_BACKTRACE(const char *format, ...) +VALGRIND_PRINTF_BACKTRACE(UNUSED const char *format, ...) { #if defined(NVALGRIND) return 0;