On Mon, Dec 28, 2015 at 01:27:50AM +0100, Jrmie Courrges-Anglas wrote:
> Stuart Henderson <st...@openbsd.org> writes:
> 
> > On 2015/12/21 17:21, Jonathan Gray wrote:
> >> Waffle is another library along the lines of GLUT that provides a way to
> >> select a windowing system and api for OpenGL.
> >> 
> >> This is primarily of interest for using the piglit OpenGL tests as
> >> Waffle is required for testing OpenGL ES.
> >
> > This fails on i386 (and presumably other 32-bit arch), ports/devel/cmocka
> > already has a patch for this situation, but the file in the version of
> > cmocka that is bundled with waffle is a bit different, I don't really
> > have time to unpick it at the moment.
> 
> Here's a backport of the cmocka fix (modulo sys/stdin.h -> stdint.h).
> Builds fine on i386.
> 
> (That cmocka header is damn ugly...)
> 
> $OpenBSD$
> 
> Avoid a conflicting typedef on 32-bit arch.
> 
> --- third_party/cmocka/include/cmocka.h.orig  Mon Dec 28 01:20:04 2015
> +++ third_party/cmocka/include/cmocka.h       Mon Dec 28 01:23:28 2015
> @@ -81,6 +81,9 @@ int __stdcall IsDebuggerPresent();
>  #define cast_to_largest_integral_type(value) \
>      ((LargestIntegralType)((size_t)(value)))
>  
> +#if defined(__OpenBSD__)
> +#include <stdint.h>
> +#else
>  /* Smallest integral type capable of holding a pointer. */
>  #if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED)
>  # if defined(_WIN32)
> @@ -109,6 +112,7 @@ int __stdcall IsDebuggerPresent();
>  # define _UINTPTR_T
>  # define _UINTPTR_T_DEFINED
>  #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
> +#endif /* !defined(__OpenBSD__) */
>  
>  /* Perform an unsigned cast to uintptr_t. */
>  #define cast_to_pointer_integral_type(value) \

I wonder if we should instead have a uintptr_t define in stdint.h
and add !defined(_UINTPTR_T_DEFINED_) ?

Index: stdint.h
===================================================================
RCS file: /cvs/src/sys/sys/stdint.h,v
retrieving revision 1.10
diff -u -p -U7 -r1.10 stdint.h
--- stdint.h    30 Apr 2015 18:19:25 -0000      1.10
+++ stdint.h    28 Dec 2015 02:26:09 -0000
@@ -89,15 +89,18 @@ typedef     __uint_fast64_t         uint_fast64_t;
 
 /* 7.18.1.4 Integer types capable of holding object pointers */
 #ifndef        _INTPTR_T_DEFINED_
 #define        _INTPTR_T_DEFINED_
 typedef        __intptr_t              intptr_t;
 #endif
 
+#ifndef        _UINTPTR_T_DEFINED_
+#define        _UINTPTR_T_DEFINED_
 typedef        __uintptr_t             uintptr_t;
+#endif
 
 /* 7.18.1.5 Greatest-width integer types */
 typedef        __intmax_t              intmax_t;
 typedef        __uintmax_t             uintmax_t;
 
 /*
  * 7.18.2 Limits of specified-width integer types.

Reply via email to