Jogamp
Include Khronos derived glcorearb.h before cl_gl.h, avoiding typedef mismatch w/...
authorSven Gothel <sgothel@jausoft.com>
Tue, 14 Jul 2015 16:28:29 +0000 (18:28 +0200)
committerSven Gothel <sgothel@jausoft.com>
Tue, 14 Jul 2015 16:28:29 +0000 (18:28 +0200)
commitf7c50fca34df0b5d393ffab0da09bce19ddfba64
tree5a8031dd5cb9d346e37e8b7e6554e5aa11b19bc1
parent263bc4eba018a78f76dcc311c55372697d592627
Include Khronos derived glcorearb.h before cl_gl.h, avoiding typedef mismatch w/ APPLE's GL

LLVM's clang reports a typedef mismatch of GLintptr and GLsizeiptr
between the Khronos derived glcorearb.h (from JOGL) and APPLE's gltypes.h when producing 32bit builds.

+++

In file included from /usr/local/projects/jogamp/jocl/build-macosx-java6/gensrc/native/jocl/CLAbstractImpl_JNI.c:15:
/usr/local/projects/jogamp/jogl/make/stub_includes/opengl/GL/glcorearb.h:604:19: error: typedef redefinition with different types
      ('ptrdiff_t' (aka 'int') vs 'intptr_t' (aka 'long'))
typedef ptrdiff_t GLintptr;
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gltypes.h:51:18: note:
      previous definition is here
typedef intptr_t GLintptr;

+++

I.e. Khronos uses ptrdiff_t (aka 'int' on 32bit), where APPLE uses intptr_t (aka 'long' on 32bit).

On OSX 32bit both ('int' and 'long') have the same sizeof value, i.e. 4 bytes,
see below, hence the ABI is compatible!

However, clang produces a typedef mismatch.

Fix includes the Khronos derived (JOGL) glcorearb.h before cl_gl.h,
hence favors the former 'canonical' definition.

+++

OSX 10.10 32bit:
  sizeof int: 4
  sizeof long: 4
  sizeof long long: 8
  sizeof intptr_t: 4
  sizeof uintptr_t: 4
  sizeof ptrdiff_t: 4
  sizeof size_t: 4
  sizeof float: 4
  sizeof double: 8
  sizeof long double: 16

OSX 10.10 64bit:
  sizeof int: 4
  sizeof long: 8
  sizeof long long: 8
  sizeof intptr_t: 8
  sizeof uintptr_t: 8
  sizeof ptrdiff_t: 8
  sizeof size_t: 8
  sizeof float: 4
  sizeof double: 8
  sizeof long double: 16
make/config/cl-impl.cfg
make/scripts/make.jocl.all.macosx-java6.sh [moved from make/scripts/make.jocl.all.macosx-clang.sh with 60% similarity]
make/scripts/make.jocl.all.macosx.sh
http://JogAmp.org git info: FAQ, tutorial and man pages.