On Mon, Dec 28, 2015 at 02:02:00PM +0100, Jrmie Courrges-Anglas wrote:
> Jonathan Gray <[email protected]> writes:
> 
> > On Mon, Dec 28, 2015 at 01:27:50AM +0100, Jrmie Courrges-Anglas wrote:
> >> Stuart Henderson <[email protected]> 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_) ?
> 
> Well, that may "solve" the cmocka problem and would be consistent with
> its signed counterpart.  But "_UINTPTR_T_DEFINED_" doesn't seem to exist
> anywhere outside of that cmocka.h header.
> 
> cmocka builds on glibc/solaris rely on implementation details.  IMHO an
> ugly ifdef __OpenBSD__ in the ports tree is better than hiding problems
> by relying on implementation details.  Maybe we can propose a better diff
> upstream (eg rely on stdint.h); I'm volunteering.
> 
> In the meantime, I'd rather use the same patch as in devel/cmocka.

Yes, it makes sense to have the same fix in both places.  I'm ok with
your diff. 

Reply via email to