1*4882a593SmuzhiyunFrom b9998bbc1e1c329f6bf69c24606a2be7a4973b8c Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: jtsiomb <jtsiomb@7f0cb862-5218-0410-a997-914c9d46530a> 3*4882a593SmuzhiyunDate: Fri, 21 Feb 2020 22:25:31 +0000 4*4882a593SmuzhiyunSubject: [PATCH] Work-around for an issue which cropped up with the release of 5*4882a593Smuzhiyun gcc-10. In their infinite wisdom, they decided to build with -fno-common as 6*4882a593Smuzhiyun default from now on, breaking every piece of C code which used to declare 7*4882a593Smuzhiyun common symbols in header files, as was the convention since the dawn of time. 8*4882a593Smuzhiyun We now have to duplicate all declarations to an arbitrary source file, and 9*4882a593Smuzhiyun change the header-file ones to prefix them with extern. 10*4882a593Smuzhiyun 11*4882a593Smuzhiyungit-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1863 7f0cb862-5218-0410-a997-914c9d46530a 12*4882a593Smuzhiyun[Retrieved from: 13*4882a593Smuzhiyunhttps://github.com/dcnieho/FreeGLUT/commit/b9998bbc1e1c329f6bf69c24606a2be7a4973b8c] 14*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 15*4882a593Smuzhiyun--- 16*4882a593Smuzhiyun freeglut/freeglut/src/fg_gl2.c | 14 ++++++++++++++ 17*4882a593Smuzhiyun freeglut/freeglut/src/fg_gl2.h | 14 +++++++------- 18*4882a593Smuzhiyun 2 files changed, 21 insertions(+), 7 deletions(-) 19*4882a593Smuzhiyun 20*4882a593Smuzhiyundiff --git a/src/fg_gl2.c b/src/fg_gl2.c 21*4882a593Smuzhiyunindex 38b0acbb..54b4285b 100644 22*4882a593Smuzhiyun--- a/src/fg_gl2.c 23*4882a593Smuzhiyun+++ b/src/fg_gl2.c 24*4882a593Smuzhiyun@@ -27,6 +27,20 @@ 25*4882a593Smuzhiyun #include "fg_internal.h" 26*4882a593Smuzhiyun #include "fg_gl2.h" 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun+#ifndef GL_ES_VERSION_2_0 29*4882a593Smuzhiyun+/* GLES2 has the corresponding entry points built-in, and these fgh-prefixed 30*4882a593Smuzhiyun+ * names are defined in fg_gl2.h header to reference them, for any other case, 31*4882a593Smuzhiyun+ * define them as function pointers here. 32*4882a593Smuzhiyun+ */ 33*4882a593Smuzhiyun+FGH_PFNGLGENBUFFERSPROC fghGenBuffers; 34*4882a593Smuzhiyun+FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; 35*4882a593Smuzhiyun+FGH_PFNGLBINDBUFFERPROC fghBindBuffer; 36*4882a593Smuzhiyun+FGH_PFNGLBUFFERDATAPROC fghBufferData; 37*4882a593Smuzhiyun+FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; 38*4882a593Smuzhiyun+FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; 39*4882a593Smuzhiyun+FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; 40*4882a593Smuzhiyun+#endif 41*4882a593Smuzhiyun+ 42*4882a593Smuzhiyun void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) { 43*4882a593Smuzhiyun if (fgStructure.CurrentWindow != NULL) 44*4882a593Smuzhiyun fgStructure.CurrentWindow->Window.attribute_v_coord = attrib; 45*4882a593Smuzhiyundiff --git a/src/fg_gl2.h b/src/fg_gl2.h 46*4882a593Smuzhiyunindex ab8ba5c7..fb3d4676 100644 47*4882a593Smuzhiyun--- a/src/fg_gl2.h 48*4882a593Smuzhiyun+++ b/src/fg_gl2.h 49*4882a593Smuzhiyun@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); 50*4882a593Smuzhiyun typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint); 51*4882a593Smuzhiyun typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun-FGH_PFNGLGENBUFFERSPROC fghGenBuffers; 54*4882a593Smuzhiyun-FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; 55*4882a593Smuzhiyun-FGH_PFNGLBINDBUFFERPROC fghBindBuffer; 56*4882a593Smuzhiyun-FGH_PFNGLBUFFERDATAPROC fghBufferData; 57*4882a593Smuzhiyun-FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; 58*4882a593Smuzhiyun-FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; 59*4882a593Smuzhiyun-FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; 60*4882a593Smuzhiyun+extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers; 61*4882a593Smuzhiyun+extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers; 62*4882a593Smuzhiyun+extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer; 63*4882a593Smuzhiyun+extern FGH_PFNGLBUFFERDATAPROC fghBufferData; 64*4882a593Smuzhiyun+extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray; 65*4882a593Smuzhiyun+extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray; 66*4882a593Smuzhiyun+extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun # endif 69*4882a593Smuzhiyun 70