Skip to content

Commit 5550742

Browse files
committed
Merge pull request #22 from dagit/clang-workarounds
dumb down our CPP so that it works in both traditional and ansi modes
2 parents cae93e2 + fdd4b42 commit 5550742

File tree

79 files changed

+1455
-1453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1455
-1453
lines changed

include/HsOpenGLRaw.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
#ifndef HSOPENGLRAW_H
1616
#define HSOPENGLRAW_H
1717

18+
#define HASH #
19+
1820
/* NOTE: The macro must immediately start with the foreign declaration,
1921
otherwise the magic mangler (hack_foreign) in the Hugs build system
2022
doesn't recognize it. */
21-
#define EXTENSION_ENTRY(_entry,_ty) \
22-
foreign import CALLCONV unsafe "dynamic" dyn_/**/_entry :: Graphics.Rendering.OpenGL.Raw.Extensions.Invoker (_ty) ; \
23+
#define EXTENSION_ENTRY(dyn_entry, ptr_entry, _entry, _ty) \
24+
foreign import CALLCONV unsafe "dynamic" dyn_entry :: Graphics.Rendering.OpenGL.Raw.Extensions.Invoker (_ty) ; \
2325
_entry :: (_ty) ; \
24-
_entry = dyn_/**/_entry ptr_/**/_entry ; \
25-
ptr_/**/_entry :: FunPtr a ; \
26-
ptr_/**/_entry = unsafePerformIO (Graphics.Rendering.OpenGL.Raw.Extensions.getExtensionEntry extensionNameString "_entry") ; \
27-
{-# NOINLINE ptr_/**/_entry #-}
26+
_entry = dyn_entry ptr_entry ; \
27+
ptr_entry :: FunPtr a ; \
28+
ptr_entry = unsafePerformIO (Graphics.Rendering.OpenGL.Raw.Extensions.getExtensionEntry extensionNameString "_entry") ; \
29+
{-HASH NOINLINE ptr_entry HASH-}
2830

2931
#endif

src/Graphics/Rendering/OpenGL/Raw/APPLE/FlushBufferRange.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import Graphics.Rendering.OpenGL.Raw.Extensions
3636
extensionNameString :: String
3737
extensionNameString = "GL_APPLE_flush_buffer_range"
3838

39-
EXTENSION_ENTRY(glBufferParameteri, GLenum -> GLenum -> GLint -> IO ())
39+
EXTENSION_ENTRY(dyn_glBufferParameteri,ptr_glBufferParameteri,glBufferParameteri, GLenum -> GLenum -> GLint -> IO ())
4040

4141
gl__BUFFER_SERIALIZED_MODIFY :: GLenum
4242
gl__BUFFER_SERIALIZED_MODIFY = 0x8A12

src/Graphics/Rendering/OpenGL/Raw/APPLE/VertexArrayObject.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ import Graphics.Rendering.OpenGL.Raw.Extensions
3737
extensionNameString :: String
3838
extensionNameString = "GL_APPLE_vertex_array_object"
3939

40-
EXTENSION_ENTRY(glBindVertexArrayAPPLE,GLuint -> IO ())
40+
EXTENSION_ENTRY(dyn_glBindVertexArrayAPPLE,ptr_glBindVertexArrayAPPLE,glBindVertexArrayAPPLE,GLuint -> IO ())

src/Graphics/Rendering/OpenGL/Raw/ARB/BlendFuncExtended.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ import Graphics.Rendering.OpenGL.Raw.Extensions
4040
extensionNameString :: String
4141
extensionNameString = "GL_ARB_blend_func_extended"
4242

43-
EXTENSION_ENTRY(glBindFragDataLocationIndexed,GLuint -> GLuint -> GLuint -> Ptr GLchar -> IO ())
44-
EXTENSION_ENTRY(glGetFragDataIndex,GLuint -> Ptr GLchar -> IO GLint)
43+
EXTENSION_ENTRY(dyn_glBindFragDataLocationIndexed,ptr_glBindFragDataLocationIndexed,glBindFragDataLocationIndexed,GLuint -> GLuint -> GLuint -> Ptr GLchar -> IO ())
44+
EXTENSION_ENTRY(dyn_glGetFragDataIndex,ptr_glGetFragDataIndex,glGetFragDataIndex,GLuint -> Ptr GLchar -> IO GLint)
4545

4646
gl_SRC1_COLOR :: GLenum
4747
gl_SRC1_COLOR = 0x88F9

src/Graphics/Rendering/OpenGL/Raw/ARB/Compatibility/Functions.hs

Lines changed: 382 additions & 382 deletions
Large diffs are not rendered by default.

src/Graphics/Rendering/OpenGL/Raw/ARB/ComputeShader.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ import Graphics.Rendering.OpenGL.Raw.Core31.Types
4848
extensionNameString :: String
4949
extensionNameString = "GL_ARB_compute_shader"
5050

51-
EXTENSION_ENTRY(glDispatchCompute,GLuint -> GLuint -> GLuint -> IO ())
52-
EXTENSION_ENTRY(glDispatchComputeIndirect,GLintptr -> IO ())
51+
EXTENSION_ENTRY(dyn_glDispatchCompute,ptr_glDispatchCompute,glDispatchCompute,GLuint -> GLuint -> GLuint -> IO ())
52+
EXTENSION_ENTRY(dyn_glDispatchComputeIndirect,ptr_glDispatchComputeIndirect,glDispatchComputeIndirect,GLintptr -> IO ())
5353

5454
gl_COMPUTE_SHADER :: GLenum
5555
gl_COMPUTE_SHADER = 0x91B9

src/Graphics/Rendering/OpenGL/Raw/ARB/CopyBuffer.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Graphics.Rendering.OpenGL.Raw.Core31.Types
3232
extensionNameString :: String
3333
extensionNameString = "GL_ARB_copy_buffer"
3434

35-
EXTENSION_ENTRY(glCopyBufferSubData,GLenum -> GLenum -> GLintptr -> GLintptr -> GLsizeiptr -> IO ())
35+
EXTENSION_ENTRY(dyn_glCopyBufferSubData,ptr_glCopyBufferSubData,glCopyBufferSubData,GLenum -> GLenum -> GLintptr -> GLintptr -> GLsizeiptr -> IO ())
3636

3737
gl_COPY_READ_BUFFER_BINDING :: GLenum
3838
gl_COPY_READ_BUFFER_BINDING = 0x8F36

src/Graphics/Rendering/OpenGL/Raw/ARB/DrawBuffersBlend.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import Graphics.Rendering.OpenGL.Raw.Extensions
3131
extensionNameString :: String
3232
extensionNameString = "GL_ARB_draw_buffers_blend"
3333

34-
EXTENSION_ENTRY(glBlendEquationi,GLuint -> GLenum -> IO ())
35-
EXTENSION_ENTRY(glBlendEquationSeparatei,GLuint -> GLenum -> GLenum -> IO ())
36-
EXTENSION_ENTRY(glBlendFunci,GLuint -> GLenum -> GLenum -> IO ())
37-
EXTENSION_ENTRY(glBlendFuncSeparatei,GLuint -> GLenum -> GLenum -> GLenum -> GLenum -> IO ())
34+
EXTENSION_ENTRY(dyn_glBlendEquationi,ptr_glBlendEquationi,glBlendEquationi,GLuint -> GLenum -> IO ())
35+
EXTENSION_ENTRY(dyn_glBlendEquationSeparatei,ptr_glBlendEquationSeparatei,glBlendEquationSeparatei,GLuint -> GLenum -> GLenum -> IO ())
36+
EXTENSION_ENTRY(dyn_glBlendFunci,ptr_glBlendFunci,glBlendFunci,GLuint -> GLenum -> GLenum -> IO ())
37+
EXTENSION_ENTRY(dyn_glBlendFuncSeparatei,ptr_glBlendFuncSeparatei,glBlendFuncSeparatei,GLuint -> GLenum -> GLenum -> GLenum -> GLenum -> IO ())
3838

src/Graphics/Rendering/OpenGL/Raw/ARB/DrawElementsBaseVertex.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Graphics.Rendering.OpenGL.Raw.Core31.Types
3232
extensionNameString :: String
3333
extensionNameString = "GL_ARB_draw_elements_base_vertex"
3434

35-
EXTENSION_ENTRY(glDrawElementsBaseVertex,GLenum -> GLsizei -> GLenum -> Ptr a -> GLint -> IO ())
36-
EXTENSION_ENTRY(glDrawRangeElementsBaseVertex,GLenum -> GLuint -> GLuint -> GLsizei -> GLenum -> Ptr a -> GLint -> IO ())
37-
EXTENSION_ENTRY(glDrawElementsInstancedBaseVertex,GLenum -> GLsizei -> GLenum -> Ptr a -> GLsizei -> GLint -> IO ())
38-
EXTENSION_ENTRY(glMultiDrawElementsBaseVertex,GLenum -> Ptr GLsizei -> GLenum -> Ptr (Ptr a) -> GLsizei -> Ptr GLint -> IO ())
35+
EXTENSION_ENTRY(dyn_glDrawElementsBaseVertex,ptr_glDrawElementsBaseVertex,glDrawElementsBaseVertex,GLenum -> GLsizei -> GLenum -> Ptr a -> GLint -> IO ())
36+
EXTENSION_ENTRY(dyn_glDrawRangeElementsBaseVertex,ptr_glDrawRangeElementsBaseVertex,glDrawRangeElementsBaseVertex,GLenum -> GLuint -> GLuint -> GLsizei -> GLenum -> Ptr a -> GLint -> IO ())
37+
EXTENSION_ENTRY(dyn_glDrawElementsInstancedBaseVertex,ptr_glDrawElementsInstancedBaseVertex,glDrawElementsInstancedBaseVertex,GLenum -> GLsizei -> GLenum -> Ptr a -> GLsizei -> GLint -> IO ())
38+
EXTENSION_ENTRY(dyn_glMultiDrawElementsBaseVertex,ptr_glMultiDrawElementsBaseVertex,glMultiDrawElementsBaseVertex,GLenum -> Ptr GLsizei -> GLenum -> Ptr (Ptr a) -> GLsizei -> Ptr GLint -> IO ())

src/Graphics/Rendering/OpenGL/Raw/ARB/DrawIndirect.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import Graphics.Rendering.OpenGL.Raw.Core31.Types
3333
extensionNameString :: String
3434
extensionNameString = "GL_ARB_draw_indirect"
3535

36-
EXTENSION_ENTRY(glDrawArraysIndirect,GLenum -> Ptr a -> IO ())
37-
EXTENSION_ENTRY(glDrawElementsIndirect,GLenum -> GLenum -> Ptr a -> IO ())
36+
EXTENSION_ENTRY(dyn_glDrawArraysIndirect,ptr_glDrawArraysIndirect,glDrawArraysIndirect,GLenum -> Ptr a -> IO ())
37+
EXTENSION_ENTRY(dyn_glDrawElementsIndirect,ptr_glDrawElementsIndirect,glDrawElementsIndirect,GLenum -> GLenum -> Ptr a -> IO ())
3838

3939
gl_DRAW_INDIRECT_BUFFER :: GLenum
4040
gl_DRAW_INDIRECT_BUFFER = 0x8F3F

0 commit comments

Comments
 (0)