1From a54e035f802e79e3292d8ad39a14bd7c060eb7b1 Mon Sep 17 00:00:00 2001 2From: Breno Leitao <breno.leitao@gmail.com> 3Date: Tue, 21 Mar 2023 21:58:28 -0700 4Subject: [PATCH] include: Check for previous declaration of uintptr_t 5 6Adding a extra check before declaring uintptr_t. Currently musl uses 7macro __DEFINED_uintptr_t once it defines uintptr_t type. Checking 8this macro before defining it, and, defining it when uintptr_t is 9defined. 10 11Taken from Alpine 12 13Upstream-Status: Pending 14Signed-off-by: Breno Leitao <breno.leitao@gmail.com> 15Signed-off-by: Khem Raj <raj.khem@gmail.com> 16--- 17 include/cmocka.h | 3 ++- 18 1 file changed, 2 insertions(+), 1 deletion(-) 19 20diff --git a/include/cmocka.h b/include/cmocka.h 21index a21d965..f540793 100644 22--- a/include/cmocka.h 23+++ b/include/cmocka.h 24@@ -121,7 +121,7 @@ typedef uintmax_t LargestIntegralType; 25 ((LargestIntegralType)(value)) 26 27 /* Smallest integral type capable of holding a pointer. */ 28-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T) 29+#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T) && !defined(__DEFINED_uintptr_t) 30 # if defined(_WIN32) 31 /* WIN32 is an ILP32 platform */ 32 typedef unsigned int uintptr_t; 33@@ -147,6 +147,7 @@ typedef uintmax_t LargestIntegralType; 34 35 # define _UINTPTR_T 36 # define _UINTPTR_T_DEFINED 37+# define __DEFINED_uintptr_t 38 #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */ 39 40 /* Perform an unsigned cast to uintptr_t. */ 41-- 422.40.0 43 44