[Mesa-dev] [PATCH] Only use gcc visibility support with gcc4+.

Alan Coopersmith alan.coopersmith at oracle.com
Wed Oct 19 15:59:25 PDT 2011


On 10/19/11 13:44, Tom Fogal wrote:
> I had a colleague hitting issues compiling with an old gcc3.2
> system.  These patches got them through.
> ---
>   include/GL/gl.h          |    2 +-
>   src/mesa/main/compiler.h |    2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/GL/gl.h b/include/GL/gl.h
> index 998a83a..e65e1bc 100644
> --- a/include/GL/gl.h
> +++ b/include/GL/gl.h
> @@ -67,7 +67,7 @@
>   #elif defined(__CYGWIN__)&&  defined(USE_OPENGL32) /* use native windows opengl32 */
>   #  define GLAPI extern
>   #  define GLAPIENTRY __stdcall
> -#elif defined(__GNUC__)	|| (defined(__SUNPRO_C)&&  (__SUNPRO_C>= 0x590))
> +#elif (defined(__GNUC__)&&  __GNUC__>= 4) || (defined(__SUNPRO_C)&&  (__SUNPRO_C>= 0x590))
>   #  define GLAPI __attribute__((visibility("default")))

That seems to match what X.Org's <X11/Xfuncproto.h> does for gcc
visibility attributes (the SUNPRO bits differ since Xorg supported
visibility attributes there in versions before they added compatibility
with the gcc style attributes):

#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)
# define _X_EXPORT      __attribute__((visibility("default")))
# define _X_HIDDEN      __attribute__((visibility("hidden")))
# define _X_INTERNAL    __attribute__((visibility("internal")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define _X_EXPORT      __global
# define _X_HIDDEN      __hidden
# define _X_INTERNAL    __hidden
#else /* not gcc >= 4 and not Sun Studio >= 8 */
# define _X_EXPORT
# define _X_HIDDEN
# define _X_INTERNAL
#endif /* GNUC >= 4 */

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the mesa-dev mailing list