selftest: include stdio.h in kselftest.h
authorTycho Andersen <tycho@tycho.ws>
Sat, 19 Jan 2019 00:12:14 +0000 (17:12 -0700)
committerShuah Khan <shuah@kernel.org>
Wed, 13 Feb 2019 15:34:47 +0000 (08:34 -0700)
While playing around with a way to skip the seccomp get_metadata test, I
noticed that this header uses printf() without defining it, leading to,

../kselftest.h: In function ‘ksft_print_header’:
../kselftest.h:61:3: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   printf("TAP version 13\n");
   ^~~~~~
../kselftest.h:61:3: warning: incompatible implicit declaration of built-in function ‘printf’
../kselftest.h:61:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

if user code doesn't also use printf.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <shuah@kernel.org>
tools/testing/selftests/kselftest.h

index a3edb2c8e43d0a83950d8b4535756ea0ec82eb8a..47e1d995c1822903499e6597bc863f3b41402e6a 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdarg.h>
+#include <stdio.h>
 
 /* define kselftest exit codes */
 #define KSFT_PASS  0