summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-17 15:02:21 -0700
committerJunio C Hamano <gitster@pobox.com>2020-03-17 15:02:21 -0700
commita7a2e12b6eb97126f9d07298f281eb1c91730750 (patch)
tree84ed769e256ef366e0f003c93530a39051de10b3 /compat
parent93d08928910200969c486328e576057aada6f9dc (diff)
parentcf82bff73f11d3197aa6b667002ea86da1dfa835 (diff)
downloadgit-a7a2e12b6eb97126f9d07298f281eb1c91730750.tar.gz
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>