mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
6302ba07e3
The configure scripts frequently use `main` returning an implicit `int`, which causes spurious failures when CC is clang 16+. This is fixed by patching the provided macros and regenerating the scripts with autoreconfHook, though it requires some manual processing (see below). The upstream `configure.ac` is written in such a way that it requires fixups and post-processing. * Fixups are required because the original build process just cats the macros together into one file. When `aclocal` is run, it does not pick up all of them. This is worked around by catting the missing macros to a file that is picked up by autoreconfHook. * Post-processing is required to populate the version information. This is done in a subshell to avoid polluting the environment with the contents of `RELEASE`. Otherwise, the build will fail because the version C macros it expects will not be defined.
206 lines
6.7 KiB
Diff
206 lines
6.7 KiB
Diff
diff --git a/dbinc/atomic.h b/dbinc/atomic.h
|
|
index 0034dcc..160c8ea 100644
|
|
--- a/dbinc/atomic.h
|
|
+++ b/dbinc/atomic.h
|
|
@@ -70,7 +70,7 @@ typedef struct {
|
|
* These have no memory barriers; the caller must include them when necessary.
|
|
*/
|
|
#define atomic_read(p) ((p)->value)
|
|
-#define atomic_init(p, val) ((p)->value = (val))
|
|
+#define atomic_init_db(p, val) ((p)->value = (val))
|
|
|
|
#ifdef HAVE_ATOMIC_SUPPORT
|
|
|
|
@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
|
|
#define atomic_inc(env, p) __atomic_inc(p)
|
|
#define atomic_dec(env, p) __atomic_dec(p)
|
|
#define atomic_compare_exchange(env, p, o, n) \
|
|
- __atomic_compare_exchange((p), (o), (n))
|
|
+ __atomic_compare_exchange_int((p), (o), (n))
|
|
static inline int __atomic_inc(db_atomic_t *p)
|
|
{
|
|
int temp;
|
|
@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
|
|
* http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
|
|
* which configure could be changed to use.
|
|
*/
|
|
-static inline int __atomic_compare_exchange(
|
|
+static inline int __atomic_compare_exchange_int(
|
|
db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
|
|
{
|
|
atomic_value_t was;
|
|
@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
|
|
#define atomic_dec(env, p) (--(p)->value)
|
|
#define atomic_compare_exchange(env, p, oldval, newval) \
|
|
(DB_ASSERT(env, atomic_read(p) == (oldval)), \
|
|
- atomic_init(p, (newval)), 1)
|
|
+ atomic_init_db(p, (newval)), 1)
|
|
#else
|
|
#define atomic_inc(env, p) __atomic_inc(env, p)
|
|
#define atomic_dec(env, p) __atomic_dec(env, p)
|
|
diff --git a/mp/mp_fget.c b/mp/mp_fget.c
|
|
index 5fdee5a..0b75f57 100644
|
|
--- a/mp/mp_fget.c
|
|
+++ b/mp/mp_fget.c
|
|
@@ -617,7 +617,7 @@ alloc: /* Allocate a new buffer header and data space. */
|
|
|
|
/* Initialize enough so we can call __memp_bhfree. */
|
|
alloc_bhp->flags = 0;
|
|
- atomic_init(&alloc_bhp->ref, 1);
|
|
+ atomic_init_db(&alloc_bhp->ref, 1);
|
|
#ifdef DIAGNOSTIC
|
|
if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
|
|
__db_errx(env,
|
|
@@ -911,7 +911,7 @@ alloc: /* Allocate a new buffer header and data space. */
|
|
MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize,
|
|
PROT_READ);
|
|
|
|
- atomic_init(&alloc_bhp->ref, 1);
|
|
+ atomic_init_db(&alloc_bhp->ref, 1);
|
|
MUTEX_LOCK(env, alloc_bhp->mtx_buf);
|
|
alloc_bhp->priority = bhp->priority;
|
|
alloc_bhp->pgno = bhp->pgno;
|
|
diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c
|
|
index 34467d2..f05aa0c 100644
|
|
--- a/mp/mp_mvcc.c
|
|
+++ b/mp/mp_mvcc.c
|
|
@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
|
|
#else
|
|
memcpy(frozen_bhp, bhp, SSZA(BH, buf));
|
|
#endif
|
|
- atomic_init(&frozen_bhp->ref, 0);
|
|
+ atomic_init_db(&frozen_bhp->ref, 0);
|
|
if (mutex != MUTEX_INVALID)
|
|
frozen_bhp->mtx_buf = mutex;
|
|
else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
|
|
@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
|
|
#endif
|
|
alloc_bhp->mtx_buf = mutex;
|
|
MUTEX_LOCK(env, alloc_bhp->mtx_buf);
|
|
- atomic_init(&alloc_bhp->ref, 1);
|
|
+ atomic_init_db(&alloc_bhp->ref, 1);
|
|
F_CLR(alloc_bhp, BH_FROZEN);
|
|
}
|
|
|
|
diff --git a/mp/mp_region.c b/mp/mp_region.c
|
|
index e6cece9..ddbe906 100644
|
|
--- a/mp/mp_region.c
|
|
+++ b/mp/mp_region.c
|
|
@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
|
|
MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
|
|
return (ret);
|
|
SH_TAILQ_INIT(&htab[i].hash_bucket);
|
|
- atomic_init(&htab[i].hash_page_dirty, 0);
|
|
+ atomic_init_db(&htab[i].hash_page_dirty, 0);
|
|
}
|
|
|
|
/*
|
|
@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
|
|
hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
|
|
mtx_base + i;
|
|
SH_TAILQ_INIT(&hp->hash_bucket);
|
|
- atomic_init(&hp->hash_page_dirty, 0);
|
|
+ atomic_init_db(&hp->hash_page_dirty, 0);
|
|
#ifdef HAVE_STATISTICS
|
|
hp->hash_io_wait = 0;
|
|
hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
|
|
diff --git a/mutex/mut_method.c b/mutex/mut_method.c
|
|
index 2588763..5c6d516 100644
|
|
--- a/mutex/mut_method.c
|
|
+++ b/mutex/mut_method.c
|
|
@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
|
|
MUTEX_LOCK(env, mtx);
|
|
ret = atomic_read(v) == oldval;
|
|
if (ret)
|
|
- atomic_init(v, newval);
|
|
+ atomic_init_db(v, newval);
|
|
MUTEX_UNLOCK(env, mtx);
|
|
|
|
return (ret);
|
|
diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
|
|
index f3922e0..e40fcdf 100644
|
|
--- a/mutex/mut_tas.c
|
|
+++ b/mutex/mut_tas.c
|
|
@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
|
|
|
|
#ifdef HAVE_SHARED_LATCHES
|
|
if (F_ISSET(mutexp, DB_MUTEX_SHARED))
|
|
- atomic_init(&mutexp->sharecount, 0);
|
|
+ atomic_init_db(&mutexp->sharecount, 0);
|
|
else
|
|
#endif
|
|
if (MUTEX_INIT(&mutexp->tas)) {
|
|
@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
|
|
F_CLR(mutexp, DB_MUTEX_LOCKED);
|
|
/* Flush flag update before zeroing count */
|
|
MEMBAR_EXIT();
|
|
- atomic_init(&mutexp->sharecount, 0);
|
|
+ atomic_init_db(&mutexp->sharecount, 0);
|
|
} else {
|
|
DB_ASSERT(env, sharecount > 0);
|
|
MEMBAR_EXIT();
|
|
diff -ur a/dist/aclocal/clock.m4 b/dist/aclocal/clock.m4
|
|
--- a/dist/aclocal/clock.m4 1969-12-31 19:00:01.000000000 -0500
|
|
+++ b/dist/aclocal/clock.m4 2023-06-05 19:14:02.007080500 -0400
|
|
@@ -21,6 +21,7 @@
|
|
AC_CACHE_CHECK([for clock_gettime monotonic clock], db_cv_clock_monotonic, [
|
|
AC_TRY_RUN([
|
|
#include <sys/time.h>
|
|
+int
|
|
main() {
|
|
struct timespec t;
|
|
return (clock_gettime(CLOCK_MONOTONIC, &t) != 0);
|
|
diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4
|
|
--- a/dist/aclocal/mutex.m4 1969-12-31 19:00:01.000000000 -0500
|
|
+++ b/dist/aclocal/mutex.m4 2023-06-05 19:14:47.214158196 -0400
|
|
@@ -4,6 +4,7 @@
|
|
AC_DEFUN(AM_PTHREADS_SHARED, [
|
|
AC_TRY_RUN([
|
|
#include <pthread.h>
|
|
+int
|
|
main() {
|
|
pthread_cond_t cond;
|
|
pthread_mutex_t mutex;
|
|
@@ -46,6 +47,7 @@
|
|
AC_DEFUN(AM_PTHREADS_PRIVATE, [
|
|
AC_TRY_RUN([
|
|
#include <pthread.h>
|
|
+int
|
|
main() {
|
|
pthread_cond_t cond;
|
|
pthread_mutex_t mutex;
|
|
diff -ur a/dist/aclocal/sequence.m4 b/dist/aclocal/sequence.m4
|
|
--- a/dist/aclocal/sequence.m4 1969-12-31 19:00:01.000000000 -0500
|
|
+++ b/dist/aclocal/sequence.m4 2023-06-05 19:14:02.007869956 -0400
|
|
@@ -43,6 +43,9 @@
|
|
# test, which won't test for the appropriate printf format strings.
|
|
if test "$db_cv_build_sequence" = "yes"; then
|
|
AC_TRY_RUN([
|
|
+ #include <string.h>
|
|
+ #include <stdio.h>
|
|
+ int
|
|
main() {
|
|
$db_cv_seq_type l;
|
|
unsigned $db_cv_seq_type u;
|
|
@@ -59,7 +62,9 @@
|
|
return (1);
|
|
return (0);
|
|
}],, [db_cv_build_sequence="no"],
|
|
- AC_TRY_LINK(,[
|
|
+ AC_TRY_LINK([
|
|
+ #include <string.h>
|
|
+ #include <stdio.h>],[
|
|
$db_cv_seq_type l;
|
|
unsigned $db_cv_seq_type u;
|
|
char buf@<:@100@:>@;
|
|
diff -ur a/dist/RELEASE b/dist/RELEASE
|
|
--- a/dist/RELEASE 1969-12-31 19:00:01.000000000 -0500
|
|
+++ b/dist/RELEASE 2023-07-02 17:32:34.703953049 -0400
|
|
@@ -7,5 +7,5 @@
|
|
|
|
DB_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DB_VERSION_MAJOR $DB_VERSION_MINOR`
|
|
|
|
-DB_RELEASE_DATE=`date "+%B %e, %Y"`
|
|
+DB_RELEASE_DATE="April 9, 2010"
|
|
DB_VERSION_STRING="Berkeley DB $DB_VERSION: ($DB_RELEASE_DATE)"
|