Stuart Henderson <s...@spacehopper.org> writes:

> On 2015/11/06 18:02, Remi Pointel wrote:
>> Hi,
>> 
>> this is the latest version of cmocka.
>
> This doesn't build on i386,

Woops...

> /usr/obj/ports/cmocka-1.0.1/cmocka-1.0.1/include/cmocka.h:113: error: 
> conflicting types for 'uintptr_t'
> /usr/include/sys/stdint.h:96: error: previous declaration of 'uintptr_t' was 
> here
>
> I think the current cmocka.h patch to add the ifdef OpenBSD is
> unnecessary, what would be better is to change the __WORDSIZE
> ifdef in line 59, but that still leaves us with problems with the
> uintptr_t typedef (they #define guards used in stdint.h on some
> platforms, _UINTPTR_T_DEFINED and _UINTPTR_T, to avoid this...
> but we don't have a specific guard for uintptr_t definition).

I didn't notice that patch at first.  This header file is quite
offending.

> This is a bit dirty but should do the trick for now. Maybe upstream
> can come up with something nicer.

Agreed.  ok jca@

> Index: patches/patch-include_cmocka_h
> ===================================================================
> RCS file: /cvs/ports/devel/cmocka/patches/patch-include_cmocka_h,v
> retrieving revision 1.3
> diff -u -p -r1.3 patch-include_cmocka_h
> --- patches/patch-include_cmocka_h    6 Nov 2015 20:58:48 -0000       1.3
> +++ patches/patch-include_cmocka_h    7 Nov 2015 14:45:44 -0000
> @@ -1,12 +1,33 @@
>  $OpenBSD: patch-include_cmocka_h,v 1.3 2015/11/06 20:58:48 rpointel Exp $
> ---- include/cmocka.h.orig    Sun Mar  1 10:31:52 2015
> -+++ include/cmocka.h Fri Nov  6 17:32:22 2015
> -@@ -112,6 +112,8 @@ typedef uintmax_t LargestIntegralType;
> - #   else
> -       typedef unsigned int uintptr_t;
> - #   endif /* __WORDSIZE == 64 */
> -+#  elif defined(__OpenBSD__)
> -+     typedef unsigned long int uintptr_t;
> - #  else /* __WORDSIZE */
> - #   if defined(_LP64) || defined(_I32LPx)
> -       typedef unsigned long int uintptr_t;
> +--- include/cmocka.h.orig    Sun Mar  1 02:31:52 2015
> ++++ include/cmocka.h Sat Nov  7 07:44:28 2015
> +@@ -56,7 +56,7 @@ int __stdcall IsDebuggerPresent();
> + 
> + /* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
> + #ifndef __WORDSIZE
> +-# if defined(__x86_64__) && !defined(__ILP32__)
> ++# if defined(_LP64)
> + #  define __WORDSIZE 64
> + # else
> + #  define __WORDSIZE 32
> +@@ -96,8 +96,11 @@ typedef uintmax_t LargestIntegralType;
> + #define cast_to_largest_integral_type(value) \
> +     ((LargestIntegralType)(value))
> + 
> ++#if defined(__OpenBSD__)
> ++#include <sys/stdint.h>
> ++#else
> + /* Smallest integral type capable of holding a pointer. */
> +-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
> ++#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && 
> !defined(_INTPTR_T_DEFINED)
> + # if defined(_WIN32)
> +     /* WIN32 is an ILP32 platform */
> +     typedef unsigned int uintptr_t;
> +@@ -124,6 +127,7 @@ typedef uintmax_t LargestIntegralType;
> + # define _UINTPTR_T
> + # define _UINTPTR_T_DEFINED
> + #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
> ++#endif
> + 
> + /* Perform an unsigned cast to uintptr_t. */
> + #define cast_to_pointer_integral_type(value) \
>


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to