[Piglit] [PATCH] glew: Move declaration before code.

Jose Fonseca jfonseca at vmware.com
Sat Jan 28 04:04:48 PST 2012


Ah. This is a tricky one.

This happens on MacOSX section of glew.c which is copied verbatim from upstream.

This code does not create problems for MSVC, as it will be always #ifdef'd out.
And if we change the code here, the problem will continue to recur, whenever the source is clobbered from upstream.

So the best solution is to disable the warning when compiling glew.c

Please try the attached patch.

Jose

----- Original Message -----
> Fixes this GCC warning on Mac OS X.
> glew.c: In function ‘NSGLGetProcAddress’:
> glew.c:112: warning: ISO C90 forbids mixed declarations and code
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/util/glew.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/util/glew.c b/tests/util/glew.c
> index 4130c53..5387940 100644
> --- a/tests/util/glew.c
> +++ b/tests/util/glew.c
> @@ -104,12 +104,13 @@ void* dlGetProcAddress (const GLubyte* name)
>  void* NSGLGetProcAddress (const GLubyte *name)
>  {
>    static void* image = NULL;
> +  void* addr;
>    if (NULL == image)
>    {
>      image =
>      dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL",
>      RTLD_LAZY);
>    }
>    if( !image ) return NULL;
> -  void* addr = dlsym(image, (const char*)name);
> +  addr = dlsym(image, (const char*)name);
>    if( addr ) return addr;
>  #ifdef GLEW_APPLE_GLX
>    return dlGetProcAddress( name ); // try next for glx symbols
> --
> 1.7.8.3
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: silence-glew-warning.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20120128/624b4dbb/attachment.bin>


More information about the Piglit mailing list