[Mesa-dev] [PATCH] mapi: Add better visibility checks
Emil Velikov
emil.l.velikov at gmail.com
Tue Nov 19 12:55:17 PST 2013
On 17/11/13 18:11, Alexander von Gluck IV wrote:
> * gl.h ensures gcc is 4.x or later before using
> hidden visibility. This change matches that behaviour
> and ensures better compatibility for older gcc versions.
Hi Alexander,
AFAICS there are, currently, 11 cases of such ifdef spaghetti in mesa.
IMHO we can easily compact all _but_ the following two into into a
single header, in a similar fashion to the inline macro (c99_compat.h).
include/GL/gl.h
include/KHR/khrplatform.h -> bump the gcc version to 4?
The gcc manual[1] indicates that the "new C++ visibility support" is
available as of gcc4[2]. Although for the sake of me I cannot find the
source of the original C visibility support. Hmm the original
khrplatform.h header does not have any of the GCC checks.
Chia-I Wu would you have any idea when C visibility support was added to
gcc? Would you have any comment on bumping the version to 4.0 ?
Would you mind ripping all this stuff out to a header rather than
carrying it around any more ?
How do other devs feel on the subject ?
Thanks,
Emil
[1] http://gcc.gnu.org/wiki/Visibility
[2] http://gcc.gnu.org/gcc-4.0/changes.html
> ---
> src/mapi/glapi/glapi.h | 2 +-
> src/mapi/u_compiler.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
> index c764271..8e17dc7 100644
> --- a/src/mapi/glapi/glapi.h
> +++ b/src/mapi/glapi/glapi.h
> @@ -61,7 +61,7 @@ extern "C" {
> # else
> # define _GLAPI_EXPORT __declspec(dllimport)
> # endif
> -# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> +# elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> # define _GLAPI_EXPORT __attribute__((visibility("default")))
> # else
> # define _GLAPI_EXPORT
> diff --git a/src/mapi/u_compiler.h b/src/mapi/u_compiler.h
> index f376e97..66c961e 100644
> --- a/src/mapi/u_compiler.h
> +++ b/src/mapi/u_compiler.h
> @@ -11,7 +11,7 @@
>
> /* Function visibility */
> #ifndef PUBLIC
> -# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> +# if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> # define PUBLIC __attribute__((visibility("default")))
> # elif defined(_MSC_VER)
> # define PUBLIC __declspec(dllexport)
>
More information about the mesa-dev
mailing list