summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2016-12-06 18:07:18 +0100
committerRalph Boehme <slow@samba.org>2017-01-02 14:12:27 +0100
commitb7ae41e6ca133e08f1dc62bd49436f51f490f46b (patch)
tree1ada84953d140ba1d5c3d9698a6dc8306d6c16c7 /lib
parent2487a423b7b5ae153690564202a582de5d8334aa (diff)
downloadsamba-b7ae41e6ca133e08f1dc62bd49436f51f490f46b.tar.gz
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 ‘<stdlib.h>’ or provide a declaration of ‘exit’ Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/replace/test/shared_mmap.c5
-rw-r--r--lib/replace/test/shared_mremap.c5
-rw-r--r--lib/replace/test/snprintf.c2
3 files changed, 9 insertions, 3 deletions
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 <unistd.h>
#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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 <unistd.h>
#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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"); }