[Mesa-dev] [PATCH] libGLw: Use newly introduced GLAPIVAR for variables

Brian Paul brianp at vmware.com
Tue Jul 17 14:21:10 UTC 2018


On 07/17/2018 07:31 AM, Stefan Dirsch wrote:
> GLAPI doesn't have an 'extern' in some circumstances. This way,
> variable declarations become definitions (fdo #100916).
> 
> Signed-off-by: Stefan Dirsch <sndirsch at suse.de>
> ---
>   GLwDrawA.h  | 12 ++++++++++--
>   GLwDrawAP.h |  4 ++--
>   2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/GLwDrawA.h b/GLwDrawA.h
> index b9711c2..21f70e7 100644
> --- a/GLwDrawA.h
> +++ b/GLwDrawA.h
> @@ -131,12 +131,20 @@
>   #define GLwNaccumAlphaSize	"accumAlphaSize"
>   #define GLwCAccumAlphaSize	"AccumAlphaSize"
>   
> +#if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
> +#  define GLAPIVAR extern __attribute__((visibility("default")))
> +#endif
> +
> +#ifndef GLAPIVAR
> +#define GLAPIVAR extern
> +#endif

Couldn't you just use #else instead of #endif / #ifndef GLAPIVAR ?

-Brian

> +
>   #ifdef __GLX_MOTIF
>   
>   typedef struct _GLwMDrawingAreaClassRec	*GLwMDrawingAreaWidgetClass;
>   typedef struct _GLwMDrawingAreaRec	*GLwMDrawingAreaWidget;
>   
> -GLAPI WidgetClass glwMDrawingAreaWidgetClass;
> +GLAPIVAR WidgetClass glwMDrawingAreaWidgetClass;
>   
>   
>   #else
> @@ -144,7 +152,7 @@ GLAPI WidgetClass glwMDrawingAreaWidgetClass;
>   typedef struct _GLwDrawingAreaClassRec	*GLwDrawingAreaWidgetClass;
>   typedef struct _GLwDrawingAreaRec	*GLwDrawingAreaWidget;
>   
> -GLAPI WidgetClass glwDrawingAreaWidgetClass;
> +GLAPIVAR WidgetClass glwDrawingAreaWidgetClass;
>   
>   
>   #endif
> diff --git a/GLwDrawAP.h b/GLwDrawAP.h
> index 4ff21b4..6d29849 100644
> --- a/GLwDrawAP.h
> +++ b/GLwDrawAP.h
> @@ -59,7 +59,7 @@ typedef struct _GLwMDrawingAreaClassRec {
>     } GLwMDrawingAreaClassRec;
>   
>   
> -GLAPI GLwMDrawingAreaClassRec glwMDrawingAreaClassRec;
> +GLAPIVAR GLwMDrawingAreaClassRec glwMDrawingAreaClassRec;
>   
>   
>   /* XT */
> @@ -70,7 +70,7 @@ typedef struct _GLwDrawingAreaClassRec {
>     GLwDrawingAreaClassPart     glwDrawingArea_class;
>     } GLwDrawingAreaClassRec;
>   
> -GLAPI GLwDrawingAreaClassRec glwDrawingAreaClassRec;
> +GLAPIVAR GLwDrawingAreaClassRec glwDrawingAreaClassRec;
>   
>   
>   #endif
> 



More information about the mesa-dev mailing list