samba/samba-wscript-c99.patch

56 lines
1.5 KiB
Diff

source3/wscript: Remove implict int and implicit function declarations
This should fix the remaining C89isms in these configure checks.
Submitted upstream: <https://gitlab.com/samba-team/samba/-/merge_requests/2807>
diff --git a/source3/wscript b/source3/wscript
index ca27deaa54381446..e77cd127e600f8c2 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1314,7 +1314,7 @@ syscall(SYS_initgroups, 16, NULL, NULL, 0);
if conf.CHECK_CODE('''
#include <time.h>
-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 <sys/sysmacros.h>
#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 <stdio.h>
#include <limits.h>
#include <signal.h>
+#include <stdlib.h>
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 <unistd.h>
-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")