Skip to content

Commit 8bb6fe8

Browse files
committed
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
2 parents 353a27a + 49f1eb3 commit 8bb6fe8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

refs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,13 @@ int ref_transaction_update(struct ref_transaction *transaction,
10941094
if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
10951095
BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
10961096

1097+
/*
1098+
* Clear flags outside the allowed set; this should be a noop because
1099+
* of the BUG() check above, but it works around a -Wnonnull warning
1100+
* with some versions of "gcc -O3".
1101+
*/
1102+
flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
1103+
10971104
flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
10981105

10991106
ref_transaction_add_update(transaction, refname, flags,

0 commit comments

Comments
 (0)