Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-11 01:35:12 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-11 01:35:12 +0300
commit8bb6fe853f6910526ed761938343cca79648a0b4 (patch)
tree7a9099eba3494b2c1187f493f13bdbd881182831 /refs.c
parent353a27ad95b726e650b5782a1056c4ca81992efb (diff)
parent49f1eb3b345ca95900e29b70a18302d700c9cd1e (diff)
Merge branch 'jk/refs-g11-workaround'
Workaround for a false-alarm by gcc-11 * jk/refs-g11-workaround: refs: work around gcc-11 warning with REF_HAVE_NEW
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 996ac27164..be687ddeb1 100644
--- a/refs.c
+++ b/refs.c
@@ -1094,6 +1094,13 @@ int ref_transaction_update(struct ref_transaction *transaction,
if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
+ /*
+ * Clear flags outside the allowed set; this should be a noop because
+ * of the BUG() check above, but it works around a -Wnonnull warning
+ * with some versions of "gcc -O3".
+ */
+ flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
+
flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
ref_transaction_add_update(transaction, refname, flags,