alpine: Fix build with Xcode 16/clang 16 (macOS 15)

Alpine’s configure script contains a check to detect the parameter type
accepted by qsort’s comparison function. It does this by doing a trial
compilation of a program with a comparison function that accepts two
void* parameters, which is the modern form specified by the standard,
and checking whether compilation succeeded. If compilation fails, it
assumes the historic pre-standard form, which uses char* parameters, and
configures Alpine accordingly.

The program for the test comparison is written in an archaic style that,
among other things, does not explicitly declare the comparison
function’s return type. This can be the subject of a compiler warning,
-Wimplicit-int.

Clang 16, included in Xcode 16, enables -Werror=implicit-int by
default[1], as does GCC 14[2]. Because this condition is now an error,
the trial compilation began failing under these compilers, causing
Alpine to be configured to use char* parameters in qsort comparison
functions. Because this does not match qsort’s actual declaration, where
comparison functions are expected to use void* parameters, this would
result in a build failure.

The program used to detect the proper type to use for qsort’s comparison
functions is updated to avoid the -Wimplicit-int problem.

[1] https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes
[2] https://gcc.gnu.org/gcc-14/porting_to.html#warnings-as-errors
This commit is contained in:
Mark Mentovai
2024-09-18 12:31:07 -04:00
committed by Renee Otten
parent 5f7ee976cc
commit 091c14ff91
3 changed files with 43 additions and 14 deletions
+2 -1
View File
@@ -34,7 +34,8 @@ depends_lib-append port:gettext-runtime \
port:libiconv \
port:ncurses
patchfiles-append patch-fix-applekeychain.diff
patchfiles-append patch-fix-applekeychain.diff \
patch-werror_implicit-int.diff
patch.pre_args-replace -p0 -p1
configure.env SSLDIR=${prefix}
@@ -164,19 +164,6 @@ index 5a61bde..05b09b2 100644
if test -z "$alpine_SYSTEM_PASSFILE" ; then
alpine_PASSFILE=".alpine.pwd"
else
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 74c2d25..60ee304 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -147,7 +147,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 649 2022-06-02 18:13:05
+Alpine Commit 659 2022-08-27 15:11:35
============= h_news =================
<HTML>
<HEAD>
--
2.11.4.GIT
@@ -0,0 +1,41 @@
From 0c44e2ae8b861e06139cfc6377cc59db0f12f781 Mon Sep 17 00:00:00 2001
From: Eduardo Chappa <chappa@washington.edu>
Date: Sun, 27 Nov 2022 17:24:57 -0700
Subject: [PATCH] * Fixes to the configure script by Florian Meyer (to fix
an implicit cast to int in a declaration of a function).
---
configure | 2 +-
configure.ac | 2 +-
pith/pine.hlp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index e6d7a705fb88..5d29dc3ba6c3 100755
--- a/configure
+++ b/configure
@@ -22039,7 +22039,7 @@ else
#endif
extern void *base;
-extern sortf(const void *, const void *);
+extern int sortf(const void *, const void *);
int sortf(a, b)
const void *a;
const void *b; { return 0; }
diff --git a/configure.ac b/configure.ac
index 05b09b2e9537..f96a4c248b39 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1969,7 +1969,7 @@ ac_cv_func_qsort_argtype,
#endif
extern void *base;
-extern sortf(const void *, const void *);
+extern int sortf(const void *, const void *);
int sortf(a, b)
const void *a;
const void *b; { return 0; }
--
2.46.1