From 2d6db0225da9632ddf25aa70839d9d6244af6a42 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky 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 #include #include -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 - int main() + int main(int argc, char** argv) { int x = GNUTLS_DIG_SHA256; }' @@ -1191,7 +1191,7 @@ then #include 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 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