nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.67k stars 625 forks source link

Handle expanded tokens #371

Open vvuk opened 2 years ago

vvuk commented 2 years ago

Extensions, especially EGL, now have tokens like:

EGL_TIMESTAMP_PENDING_ANDROID EGL_CAST(EGLnsecsANDROID,-2)
EGL_COLORSPACE_sRGB 0x3089
EGL_NO_NATIVE_FENCE_FD_ANDROID -1

This expands the tokens regex to handle them.

Unfortunately this now leads to warnings like:

include/GL/eglew.h:186:9: warning: 'EGL_NO_SURFACE' macro redefined [-Wmacro-redefined]
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
        ^
include/GL/eglew.h:170:9: note: previous definition is here
#define EGL_NO_SURFACE                    ((EGLSurface)0)

I think the non-EGL_CAST version comes from auto/glfixes but I don't know if the fix is to just delete these entries from there? EGL_CAST is in eglplatform so no issues with having things defined in terms of it.

nigels-com commented 2 years ago

Interesting, thanks.

nigels-com commented 2 years ago

I think it would preferable for eglew.h not to depend on the EGL_CAST macro. On the assumption that EGL_CAST macro is something added, that can't always be assumed. Perhaps ideally they could be converted from EGL_CAST(EGLSurface,0) ((EGLSurface)0) for compatibility purposes?