Blob Blame History Raw
commit 867b309eced9e02b63412855440cd4f5f7727431
Author: Sam James <sam@gentoo.org>
Date:   Sat Nov 19 18:43:26 2022 +0000

    configure: fix -Wimplicit-function-declaration, -Wimplicit-int

    Clang 16 makes -Wimplicit-function-declaration and -Wimplicit-int errors by default. Unfortunately,
    this can lead to misconfiguration or miscompilation of software as configure
    tests may then return the wrong result.

    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.

    Followup to 6414681ae99d6a0f460f827648f114aa3cb2e419.

    Signed-off-by: Sam James <sam@gentoo.org>

diff --git a/acinclude.m4 b/acinclude.m4
index 56af5590c59f97a4..ce641f0812038b0b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -79,8 +79,10 @@ AC_DEFUN([AC_LBL_UNALIGNED_ACCESS],
 #       include <sys/types.h>
 #       include <sys/wait.h>
 #       include <stdio.h>
+#       include <stdlib.h>
+#       include <unistd.h>
         unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
-        main() {
+        int main(void) {
         unsigned int i;
         pid_t pid;
         int status;
diff --git a/configure b/configure
index b9511d1d579d05e8..26824f98bfdf03dc 100755
--- a/configure
+++ b/configure
@@ -4491,8 +4491,10 @@ else
 #       include <sys/types.h>
 #       include <sys/wait.h>
 #       include <stdio.h>
+#       include <stdlib.h>
+#       include <unistd.h>
         unsigned char a[5] = { 1, 2, 3, 4, 5 };
-        main() {
+        int main(void) {
         unsigned int i;
         pid_t pid;
         int status;
@@ -6211,7 +6213,7 @@ $as_echo "Please note that some screen refreshs may fail" >&6; }
 $as_echo_n "checking for ncurses version... " >&6; }
 	ncurses_version=unknown
 cat > conftest.$ac_ext <<EOF
-#line 6214 "configure"
+#line 6204 "configure"
 #include "confdefs.h"
 #ifdef RENAMED_NCURSES
 #include <curses.h>