From 7e7b282f0150ed32c1652e36df07cbf8841cfc0b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 21 Nov 2022 13:37:41 +0100 Subject: [PATCH 1/3] buildtools/wafsamba: Avoid calling lib_func without a prototype This is a backport of commit f4c0a750d4adebcf2342a44e85f04526c34 ("WAF: Fix detection of linker features") to buildtools/wafsamba/samba_conftests.py. It fixes the check for rpath support with compilers in strict C99 mode. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15281 Signed-off-by: Florian Weimer Reviewed-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit 75db84b1e59a42737343445c43c41494460c89f0) --- buildtools/wafsamba/samba_waf18.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py index e2a078bd3a0..cfdceea14ca 100644 --- a/buildtools/wafsamba/samba_waf18.py +++ b/buildtools/wafsamba/samba_waf18.py @@ -209,7 +209,8 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None): lib_node.parent.mkdir() lib_node.write('int lib_func(void) { return 42; }\n', 'w') main_node = bld.srcnode.make_node('main.c') - main_node.write('int main(void) {return !(lib_func() == 42);}', 'w') + main_node.write('int lib_func(void);\n' + 'int main(void) {return !(lib_func() == 42);}', 'w') linkflags = [] if version_script: script = bld.srcnode.make_node('ldscript') -- 2.39.0 From b8bd5a07c1cc69a3172cbae4f26bf02cb98fe027 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 21 Nov 2022 13:53:17 +0100 Subject: [PATCH 2/3] source3/wscript: Fix detection of major/minor macros These macros are only available via as of glibc commit e16deca62e16f645213dffd4ecd1153c37765f17 ("[BZ #19239] Don't include sys/sysmacros.h from sys/types.h."), which went into glibc 2.28. This is different from the usual C99 cleanups because it changes the configure check result with existing compilers that usually accept implicit function declarations. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15281 Signed-off-by: Florian Weimer Reviewed-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit d0ee9d5a43072ecbd37327f5dc936c546f97ba34) --- source3/wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/wscript b/source3/wscript index 22be17a1a6f..ca27deaa543 100644 --- a/source3/wscript +++ b/source3/wscript @@ -603,11 +603,11 @@ msg.msg_accrightslen = sizeof(fd); conf.CHECK_HEADERS('asm/types.h') conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN", - headers='unistd.h sys/types.h', + headers='sys/sysmacros.h unistd.h sys/types.h', msg="Checking for major macro") conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN", - headers='unistd.h sys/types.h', + headers='sys/sysmacros.h unistd.h sys/types.h', msg="Checking for minor macro") conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off', -- 2.39.0 From 372efd7bae74a98d0e9839a4b76358c5be4717d0 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 21 Nov 2022 14:12:43 +0100 Subject: [PATCH 3/3] source3/wscript: Remove implicit int and implicit function declarations This should fix the remaining C89isms in these configure checks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15281 Signed-off-by: Florian Weimer Reviewed-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit 7779050a6765a37cc0c6438309e512782220dcb3) --- source3/wscript | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source3/wscript b/source3/wscript index ca27deaa543..e77cd127e60 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1314,7 +1314,7 @@ syscall(SYS_initgroups, 16, NULL, NULL, 0); if conf.CHECK_CODE(''' #include -main() { +int main() { struct tm *tm; if (sizeof(time_t) == 8) { time_t max_time = 0x7fffffffffffffffll; @@ -1345,7 +1345,7 @@ main() { #if defined(HAVE_SYS_SYSMACROS_H) #include #endif -main() { dev_t dev = makedev(1,2); return 0; } +int main() { dev_t dev = makedev(1,2); return 0; } ''', 'HAVE_MAKEDEV', addmain=False, @@ -1355,12 +1355,13 @@ main() { dev_t dev = makedev(1,2); return 0; } #include #include #include +#include void exit_on_core(int ignored) { exit(1); } -main() { +int main() { char *newpath; signal(SIGSEGV, exit_on_core); newpath = realpath("/tmp", NULL); @@ -1517,9 +1518,9 @@ main() { # Check for getcwd allowing a NULL arg. conf.CHECK_CODE(''' #include -main() { +int main() { char *s = getcwd(NULL,0); - exit(s != NULL ? 0 : 1); + return s != NULL ? 0 : 1; }''', 'GETCWD_TAKES_NULL', addmain=False, execute=True, msg="getcwd takes a NULL argument") -- 2.39.0