-
Notifications
You must be signed in to change notification settings - Fork 37.7k
contrib: embed C++11 patch in install_db4.sh #20665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Diff between old and new patch--- clang.patch 2020-12-16 16:55:03.987104506 +0100
+++ clang_cxx_11.patch 2020-12-16 16:54:47.747154861 +0100
@@ -1,7 +1,13 @@
-diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
-index 6a858f7..9f338dc 100644
---- a/src/dbinc/atomic.h
-+++ b/src/dbinc/atomic.h
+commit 3311d68f11d1697565401eee6efc85c34f022ea7
+Author: fanquake <fanquake@gmail.com>
+Date: Mon Aug 17 20:03:56 2020 +0800
+
+ Fix C++11 compatibility
+
+diff --git a/dbinc/atomic.h b/dbinc/atomic.h
+index 0034dcc..7c11d4a 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.
*/
@@ -38,11 +44,11 @@
#else
#define atomic_inc(env, p) __atomic_inc(env, p)
#define atomic_dec(env, p) __atomic_dec(env, p)
-diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
-index 16de695..d0dcc29 100644
---- a/src/mp/mp_fget.c
-+++ b/src/mp/mp_fget.c
-@@ -649,7 +649,7 @@ alloc: /* Allocate a new buffer header and data space. */
+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;
@@ -50,9 +56,9 @@
+ atomic_init_db(&alloc_bhp->ref, 1);
#ifdef DIAGNOSTIC
if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
- __db_errx(env, DB_STR("3025",
-@@ -955,7 +955,7 @@ alloc: /* Allocate a new buffer header and data space. */
- MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ __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);
@@ -60,10 +66,10 @@
MUTEX_LOCK(env, alloc_bhp->mtx_buf);
alloc_bhp->priority = bhp->priority;
alloc_bhp->pgno = bhp->pgno;
-diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
-index 770bad8..e28cce0 100644
---- a/src/mp/mp_mvcc.c
-+++ b/src/mp/mp_mvcc.c
+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));
@@ -82,11 +88,11 @@
F_CLR(alloc_bhp, BH_FROZEN);
}
-diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
-index 4952030..47645f8 100644
---- a/src/mp/mp_region.c
-+++ b/src/mp/mp_region.c
-@@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+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);
@@ -95,20 +101,20 @@
}
/*
-@@ -302,7 +302,7 @@ no_prealloc:
- } else
- hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
+@@ -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/src/mutex/mut_method.c b/src/mutex/mut_method.c
-index 09353b0..177353c 100644
---- a/src/mutex/mut_method.c
-+++ b/src/mutex/mut_method.c
-@@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
+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)
@@ -117,11 +123,11 @@
MUTEX_UNLOCK(env, mtx);
return (ret);
-diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
-index 106b161..fc4de9d 100644
---- a/src/mutex/mut_tas.c
-+++ b/src/mutex/mut_tas.c
-@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+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))
@@ -130,7 +136,7 @@
else
#endif
if (MUTEX_INIT(&mutexp->tas)) {
-@@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
+@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
F_CLR(mutexp, DB_MUTEX_LOCKED);
/* Flush flag update before zeroing count */
MEMBAR_EXIT();
@@ -138,4 +144,4 @@
+ atomic_init_db(&mutexp->sharecount, 0);
} else {
DB_ASSERT(env, sharecount > 0);
- MEMBAR_EXIT();
\ No newline at end of file
+ MEMBAR_EXIT(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gruve-p can you squash your commits. |
@fanquake Squashed |
Ready for rereview @laanwj |
When I asked you to squash I'd assumed you'd actually tested that this works. I've checked that this produces the same CFLAGS="-Wno-error=implicit-function-declaration" ./contrib/install_db4.sh $(pwd)
...
x db-4.8.30.NC/txn/txn_stat.c
x db-4.8.30.NC/txn/txn_util.c
can't find file to patch at input line 11
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|commit 3311d68f11d1697565401eee6efc85c34f022ea7
|Author: fanquake <fanquake@gmail.com>
|Date: Mon Aug 17 20:03:56 2020 +0800
|
| Fix C++11 compatibility
|
|diff --git a/dbinc/atomic.h b/dbinc/atomic.h
|index 0034dcc..7c11d4a 100644
|--- a/dbinc/atomic.h
|+++ b/dbinc/atomic.h
--------------------------
File to patch: You'll need to fix the paths, something like: diff --git a/contrib/install_db4.sh b/contrib/install_db4.sh
index 0a022229e..3c88de16e 100755
--- a/contrib/install_db4.sh
+++ b/contrib/install_db4.sh
@@ -75,10 +75,10 @@ Date: Mon Aug 17 20:03:56 2020 +0800
Fix C++11 compatibility
-diff --git a/dbinc/atomic.h b/dbinc/atomic.h
+diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
index 0034dcc..7c11d4a 100644
---- a/dbinc/atomic.h
-+++ b/dbinc/atomic.h
+--- a/src/dbinc/atomic.h
++++ b/src/dbinc/atomic.h
@@ -70,7 +70,7 @@ typedef struct {
* These have no memory barriers; the caller must include them when necessary.
*/
@@ -115,10 +115,10 @@ index 0034dcc..7c11d4a 100644
#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
+diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
index 5fdee5a..0b75f57 100644
---- a/mp/mp_fget.c
-+++ b/mp/mp_fget.c
+--- a/src/mp/mp_fget.c
++++ b/src/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. */
@@ -137,10 +137,10 @@ index 5fdee5a..0b75f57 100644
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
+diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
index 34467d2..f05aa0c 100644
---- a/mp/mp_mvcc.c
-+++ b/mp/mp_mvcc.c
+--- a/src/mp/mp_mvcc.c
++++ b/src/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));
@@ -159,10 +159,10 @@ index 34467d2..f05aa0c 100644
F_CLR(alloc_bhp, BH_FROZEN);
}
-diff --git a/mp/mp_region.c b/mp/mp_region.c
+diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
index e6cece9..ddbe906 100644
---- a/mp/mp_region.c
-+++ b/mp/mp_region.c
+--- a/src/mp/mp_region.c
++++ b/src/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);
@@ -181,10 +181,10 @@ index e6cece9..ddbe906 100644
#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
+diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
index 2588763..5c6d516 100644
---- a/mutex/mut_method.c
-+++ b/mutex/mut_method.c
+--- a/src/mutex/mut_method.c
++++ b/src/mutex/mut_method.c
@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
MUTEX_LOCK(env, mtx);
ret = atomic_read(v) == oldval;
@@ -194,10 +194,10 @@ index 2588763..5c6d516 100644
MUTEX_UNLOCK(env, mtx);
return (ret);
-diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
+diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
index f3922e0..e40fcdf 100644
---- a/mutex/mut_tas.c
-+++ b/mutex/mut_tas.c
+--- a/src/mutex/mut_tas.c
++++ b/src/mutex/mut_tas.c
@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
#ifdef HAVE_SHARED_LATCHES Once you're done fixing the changes, make sure you've squashed to a single commit, and write a more meaningful commit message, i.e: "contrib: embed C++11 patch in install_db4.sh" & explain why it's being done. Also, in future, please don't open new PRs for the same change. |
@fanquake Fixed, squashed, changed commit message, force pushed then the PR closed again. Can you reopen it? |
It's no longer possible to reopen this PR, probably because you force pushed to the branch while the PR was closed, so you will actually have to open another now. |
New one opened |
9237003 contrib: embed C++11 patch in install_db4.sh (jackielove4u) Pull request description: This is a continuation of bitcoin/bitcoin#20665. Closes #20722. ACKs for top commit: laanwj: ACK 9237003 fanquake: ACK 9237003. Tree-SHA512: ebfd16f5301158de1acc1b8eeca43b3d94f0a6d438832133a30648e5e8a88268b4af983be0bb57f3018e3af8459f32f0de676c1b4e8942e199a4497c776631c5
9237003 contrib: embed C++11 patch in install_db4.sh (jackielove4u) Pull request description: This is a continuation of bitcoin#20665. Closes bitcoin#20722. ACKs for top commit: laanwj: ACK 9237003 fanquake: ACK 9237003. Tree-SHA512: ebfd16f5301158de1acc1b8eeca43b3d94f0a6d438832133a30648e5e8a88268b4af983be0bb57f3018e3af8459f32f0de676c1b4e8942e199a4497c776631c5
Move away from gist patch to an embedded patch in the script with a heredoc.