-
Kir Kolyshkin authored
clang complains about an unused function: > clang -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 > -iquote ./arch/x86/include -c -o parseargs.o parseargs.c > parseargs.c:12:1: error: unused function '__check_help' > [-Werror,-Wunused-function] > TEST_OPTION(help, bool, "print help message and exit", 0); > ^ > ./zdtmtst.h:71:2: note: expanded from macro 'TEST_OPTION' > param_check_##type(name, &(name)); > \ > ^ > <scratch space>:46:1: note: expanded from here > param_check_bool > ^ > ./zdtmtst.h:84:35: note: expanded from macro 'param_check_bool' > #define param_check_bool(name, p) __param_check(name, p, int) > ^ > ./zdtmtst.h:78:22: note: expanded from macro '__param_check' > static inline type *__check_##name(void) { return(p); } > ^ > <scratch space>:47:1: note: expanded from here > __check_help > ^ > 1 error generated. > <builtin>: recipe for target 'parseargs.o' failed As far as I can tell, the functions __check_##name are generated in order to check the argument type by the compiler. For gcc, the "inline" keyword is enough to suppress the "unused function" warning even when -Wunused-function is used. For clang, it's not the case (see https://llvm.org/bugs/show_bug.cgi?id=22712). A way to "use" the function is to use its name as a pointer and cast it to void. This is what this patch does. Signed-off-by:
Kir Kolyshkin <kir@openvz.org> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
3c75cf51
Name |
Last commit
|
Last update |
---|---|---|
Documentation | ||
contrib | ||
coredump | ||
crit | ||
criu | ||
images | ||
lib | ||
scripts | ||
test | ||
.gitignore | ||
.mailmap | ||
.travis.yml | ||
COPYING | ||
CREDITS | ||
INSTALL.md | ||
Makefile | ||
Makefile.install | ||
Makefile.versions | ||
README.md |