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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
https://bugs.gentoo.org/879715
https://github.com/net-snmp/net-snmp/commit/ddec5fa0ed1c76fde5eea9b974442faeec008526
https://github.com/net-snmp/net-snmp/commit/fec0f9ee59d5d89c28d70bb35fad29a0013d048c
https://github.com/net-snmp/net-snmp/commit/f362b354ce993d7394bf77db41bb27cfe8d1e307
From ddec5fa0ed1c76fde5eea9b974442faeec008526 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 17 Nov 2022 00:10:09 +0000
Subject: [PATCH] configure.d: fix compatibility with Clang 16
Clang 16 makes -Wimplicit-function-declaration and -Wimplicit-int an error by
default. Unfortunately, this can lead to misconfiguration or miscompilation of
software as configure tests may then return the wrong result.
We also fix -Wstrict-prototypes while here as it's easy to do and it prepares
us for C23.
For more information, see LWN.net [0] or LLVM's Discourse [1], the Gentoo wiki
[2], or the (new) c-std-porting mailing list [3].
[0] https://lwn.net/Articles/913505/
[1] https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
[2] https://wiki.gentoo.org/wiki/Modern_C_porting
[3] hosted at lists.linux.dev.
Bug: https://bugs.gentoo.org/879715
Signed-off-by: Sam James <sam@gentoo.org>
[ bvanassche: removed two header file guards ]
--- a/configure
+++ b/configure
@@ -28483,7 +28483,14 @@ else
#ifdef HAVE_SYS_FS_TYPES_H
#include <sys/fs_types.h>
#endif
-int main ()
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+int main(void)
{
struct fs_data fsd;
/* Ultrix's statfs returns 1 for success,
@@ -31851,8 +31858,10 @@ else
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
+#include <stddef.h>
+#include <stdlib.h>
-int main(int argc, char **argv)
+int main(void)
{
int mib[2];
size_t len;
--- a/configure.d/config_os_functions
+++ b/configure.d/config_os_functions
@@ -216,7 +216,14 @@ AC_CACHE_VAL(
#ifdef HAVE_SYS_FS_TYPES_H
#include <sys/fs_types.h>
#endif
-int main ()
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
+int main(void)
{
struct fs_data fsd;
/* Ultrix's statfs returns 1 for success,
--- a/configure.d/config_os_misc4
+++ b/configure.d/config_os_misc4
@@ -185,8 +185,10 @@ else
#if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif
+#include <stddef.h>
+#include <stdlib.h>
-int main(int argc, char **argv)
+int main(void)
{
int mib[2];
size_t len;
From fec0f9ee59d5d89c28d70bb35fad29a0013d048c Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 17 Nov 2022 00:13:55 +0000
Subject: [PATCH] agent/mibgroup: fix -Wstrict-prototypes
Clang 16 warns on this. Fix it in preparation for C23.
Signed-off-by: Sam James <sam@gentoo.org>
[ bvanassche: minor formatting changes ]
--- a/agent/mibgroup/agentx/protocol.c
+++ b/agent/mibgroup/agentx/protocol.c
@@ -1895,7 +1895,7 @@ agentx_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data,
#ifdef TESTING
-testit(netsnmp_pdu *pdu1)
+void testit(netsnmp_pdu *pdu1)
{
char packet1[BUFSIZ];
char packet2[BUFSIZ];
@@ -1964,7 +1964,7 @@ testit(netsnmp_pdu *pdu1)
-main()
+int main(void)
{
netsnmp_pdu pdu1;
oid oid_buf[] = { 1, 3, 6, 1, 2, 1, 10 };
--- a/agent/mibgroup/header_complex.c
+++ b/agent/mibgroup/header_complex.c
@@ -569,7 +569,7 @@ header_complex_dump(struct header_complex_index *thestuff)
}
}
-main()
+int main(void)
{
oid oidsave[MAX_OID_LEN];
int len = MAX_OID_LEN, len2;
From f362b354ce993d7394bf77db41bb27cfe8d1e307 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 17 Nov 2022 00:20:04 +0000
Subject: [PATCH] agent: fix -Wincompatible-function-pointer-types
Clang 16 makes -Wincompatible-function-pointer-types an error by default.
Fixes the following error:
```
mibgroup/if-mib/data_access/interface_linux.c:159:23: error: incompatible function pointer types assigning to 'void (*)(char *, ...) __attribute__((noreturn))' from 'void (char *, ...)' [-Wincompatible-function-pointer-types]
pci_access->error = netsnmp_pci_error;
^ ~~~~~~~~~~~~~~~~~
1 error generated.
```
Signed-off-by: Sam James <sam@gentoo.org>
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
@@ -31,7 +31,7 @@ static struct pci_access *pci_access;
/* Avoid letting libpci call exit(1) when no PCI bus is available. */
static int do_longjmp =0;
static jmp_buf err_buf;
-static void
+PCI_NONRET static void
netsnmp_pci_error(char *msg, ...)
{
va_list args;
|