summaryrefslogtreecommitdiff
path: root/net-fs/samba/files/samba-4.15.12-configure-clang16.patch
blob: 0d9c919bd9eb06c315dcd5b6a8dd7a9406f58f34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
https://bugs.gentoo.org/870043
https://gitlab.com/samba-team/samba/-/merge_requests/2807

From afc5144819e0db141aa9c58de385e5829b952096 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
--- 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')
GitLab
From d8c6a9e5558085dfdb144bb64365822415affe84 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
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 <sys/sysmacros.h> 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.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
--- 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',
GitLab
From 1f5c44d982c112e21879b64911a4184c063ba4d4 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 21 Nov 2022 14:12:43 +0100
Subject: [PATCH 3/3] source3/wscript: Remove implict int and implicit function
 declarations

This should fix the remaining C89isms in these configure checks.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
--- 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")
 
GitLab