summaryrefslogtreecommitdiff
blob: 08df8eb0b03baaf79126c0ae1cf428d06a64056d (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
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
From 2d6db0225da9632ddf25aa70839d9d6244af6a42 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Thu, 23 Feb 2023 17:37:33 -0500
Subject: [PATCH 1/1] configure.ac: update main() signatures to conform to the
 standard.

There are some tests in configure.ac that contain,

  int main() { ... }

That's not the correct signature for main() according to the C
standard, and newer compilers are going to reject it. More information
about this can be found at,

  https://wiki.gentoo.org/wiki/Modern_C_porting

In this case, the fix is simply to write

  int main(int argc, char** argv) { ... }

instead.
---
 configure.ac | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1eaa95d8..d8162303 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,7 @@ dnscheck='
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h> 
-int main() {
+int main(int argc, char** argv) {
 res_mkquery (0, 0, 0, 0, 0, 0, 0, 0, 0);
 dn_expand (0, 0, 0, 0, 0);
 dn_skipname (0, 0);
@@ -549,7 +549,7 @@ gprof_gmon_out="unknown"
 if test x"$hasgprof" = x"yes"
 then
 	gprofcheck='
-int main() {
+int main(int argc, char** argv) {
 	long x;
 
 	x = random();
@@ -747,7 +747,7 @@ then
 		#if GNUTLS_VERSION_NUMBER < 0x020b07
 		# error GnuTLS 2.11.7 or later required
 		#endif 
-		int main()
+		int main(int argc, char** argv)
 		{
 			return 0;
 		}'
@@ -759,7 +759,7 @@ then
 
 	sha256check='
 		#include <gnutls/gnutls.h>
-		int main()
+		int main(int argc, char** argv)
 		{
 			int x = GNUTLS_DIG_SHA256;
 		}'
@@ -1191,7 +1191,7 @@ then
 #include <libmemcached/memcached.h>
 
 int
-main()
+main(int argc, char** argv)
 {
 	memcached_return_t x;
 
@@ -1649,7 +1649,7 @@ then
 #endif
 
 int
-main()
+main(int argc, char** argv)
 {
 	return 0;
 }
@@ -1859,7 +1859,7 @@ then
 #endif
 
 int
-main()
+main(int argc, char** argv)
 {
 	return 0;
 }
-- 
2.39.2

From 1f551737e838723f9ad9be1692bb12a9a3b4cdd9 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Thu, 23 Feb 2023 18:15:50 -0500
Subject: [PATCH 2/2] libvbr/vbr.c: modernize vbr_strlcpy() signature.

The vbr_strlcpy() function declares that its arguments should live in
registers:

  vbr_strlcpy(dst, src, size)
        register char *dst;
        register const char *src;
        ssize_t size;
  {
    ...

This makes GCC unhappy when -Werror=strict-prototypes is used:

  vbr.c:167:1: error: function declaration isn't a prototype
  [-Werror=strict-prototypes]
    167 | vbr_strlcpy(dst, src, size)

The "register" keyword is largely obsolete on modern systems anyway,
since the compiler is better at determining how to move memory around
than the programmer is. So to appease GCC and simplify the code a bit,
the signature has been changed to,

  vbr_strlcpy(char *dst, const char *src, ssize_t size) { ... }

changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit.  # # On branch configure.ac-c-standard #
Your branch is up to date with 'origin/configure.ac-c-standard'.  # #
Changes to be committed: # modified: libvbr/vbr.c # # Changes not
staged for commit: # modified: configure # # Untracked files: #
0000-cover-letter.patch #
---
 libvbr/vbr.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libvbr/vbr.c b/libvbr/vbr.c
index cb9124d7..c6a2439f 100644
--- a/libvbr/vbr.c
+++ b/libvbr/vbr.c
@@ -164,12 +164,9 @@ static void vbr_error __P((VBR *, const char *, ...));
 */
 
 size_t
-vbr_strlcpy(dst, src, size)
-	register char *dst;
-	register const char *src;
-	ssize_t size;
+vbr_strlcpy(char *dst, const char *src, ssize_t size)
 {
-	register ssize_t i;
+	ssize_t i;
 
 	if (size-- <= 0)
 		return strlen(src);
-- 
2.39.2