From: Lukas Slebodnik Date: Tue, 6 Dec 2016 17:07:18 +0000 (+0100) Subject: lib replace: Fix detection of features X-Git-Tag: samba-4.6.0rc1~75 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=b7ae41e6ca133e08f1dc62bd49436f51f490f46b;p=samba.git lib replace: Fix detection of features If configure script is executed with stricter cflags "-Werrorr=implicit-function-declaration -Werror=implicit-int" then detection of few features will fail. Checking for C99 vsnprintf : not found Checking for HAVE_SHARED_MMAP : not found Checking for HAVE_MREMAP : not found lib/replace/test/shared_mmap.c:18:1: error: return type defaults to ‘int’ [-Werror=implicit-int] main() ^~~~ lib/replace/test/shared_mmap.c: In function ‘main’: lib/replace/test/shared_mmap.c:25:16: error: implicit declaration of function ‘exit’ [-Werror=implicit-function-declaration] if (fd == -1) exit(1); ^~~~ lib/replace/test/shared_mmap.c:25:16: warning: incompatible implicit declaration of built-in function ‘exit’ lib/replace/test/shared_mmap.c:25:16: note: include ‘’ or provide a declaration of ‘exit’ Signed-off-by: Lukas Slebodnik Reviewed-by: Andreas Schneider Reviewed-by: Ralph Boehme --- diff --git a/lib/replace/test/shared_mmap.c b/lib/replace/test/shared_mmap.c index 50dad8d6964..9d6e3fc95aa 100644 --- a/lib/replace/test/shared_mmap.c +++ b/lib/replace/test/shared_mmap.c @@ -4,6 +4,9 @@ #if defined(HAVE_UNISTD_H) #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif #include #include #include @@ -15,7 +18,7 @@ #define MAP_FILE 0 #endif -main() +int main(void) { int *buf; int i; diff --git a/lib/replace/test/shared_mremap.c b/lib/replace/test/shared_mremap.c index 05032ad12e3..08040e2e595 100644 --- a/lib/replace/test/shared_mremap.c +++ b/lib/replace/test/shared_mremap.c @@ -3,6 +3,9 @@ #if defined(HAVE_UNISTD_H) #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif #include #include #include @@ -18,7 +21,7 @@ #define MAP_FAILED (int *)-1 #endif -main() +int main(void) { int *buf; int fd; diff --git a/lib/replace/test/snprintf.c b/lib/replace/test/snprintf.c index d06630bcc98..77473f067b2 100644 --- a/lib/replace/test/snprintf.c +++ b/lib/replace/test/snprintf.c @@ -26,4 +26,4 @@ void foo(const char *format, ...) printf("1"); exit(0); } -main() { foo("hello"); } +int main(void) { foo("hello"); }