summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-03-17 15:02:21 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-03-17 15:02:21 -0700
commita7a2e12b6eb97126f9d07298f281eb1c91730750 (patch)
tree84ed769e256ef366e0f003c93530a39051de10b3 /compat
parentMerge branch 'dt/submodule-rm-with-stale-cache' into maint (diff)
parentobstack: avoid computing offsets from NULL pointer (diff)
downloadtgif-a7a2e12b6eb97126f9d07298f281eb1c91730750.tar.xz
Merge branch 'jk/clang-sanitizer-fixes' into maint
C pedantry ;-) fix. * jk/clang-sanitizer-fixes: obstack: avoid computing offsets from NULL pointer xdiff: avoid computing non-zero offset from NULL pointer avoid computing zero offsets from NULL pointer merge-recursive: use subtraction to flip stage merge-recursive: silence -Wxor-used-as-pow warning
Diffstat (limited to 'compat')
-rw-r--r--compat/obstack.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/compat/obstack.h b/compat/obstack.h
index 01e7c81840..f90a46d9b9 100644
--- a/compat/obstack.h
+++ b/compat/obstack.h
@@ -135,8 +135,10 @@ extern "C" {
alignment relative to 0. */
#define __PTR_ALIGN(B, P, A) \
- __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
- P, A)
+ (sizeof (PTR_INT_TYPE) < sizeof(void *) ? \
+ __BPTR_ALIGN((B), (P), (A)) : \
+ (void *)__BPTR_ALIGN((PTR_INT_TYPE)(void *)0, (PTR_INT_TYPE)(P), (A)) \
+ )
#include <string.h>