]> git.ipfire.org Git - thirdparty/git.git/commit - git-compat-util.h
do full type check in BARF_UNLESS_COPYABLE
authorRené Scharfe <l.s.r@web.de>
Sun, 1 Jan 2023 21:11:20 +0000 (22:11 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jan 2023 04:28:36 +0000 (13:28 +0900)
commit08e8c266653a486cc441ec031136875bf579f054
tree055c18b9bb55f3ce1e35409acb48dfbfc601045e
parent1891846fa4d439be7f9a1a32c062f62cd863df2b
do full type check in BARF_UNLESS_COPYABLE

Use __builtin_types_compatible_p to perform a full type check if
possible.  Otherwise fall back to the old size comparison, but add a
non-evaluated assignment to catch more type mismatches.  It doesn't flag
copies between arrays with different signedness, but that's as close to
a full type check as it gets without the builtin, as far as I can see.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h