Mesa (master): mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro

Emil Velikov evelikov at kemper.freedesktop.org
Wed Jan 18 16:03:36 UTC 2017


Module: Mesa
Branch: master
Commit: dfc84c2296891858ef9d12800ae778063b76c05a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfc84c2296891858ef9d12800ae778063b76c05a

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Mon Dec  5 19:52:43 2016 +0000

mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro

We must make sure that xserver has an equivalent one-line
change to its configure.ac as the glx/glapi headers get copied over.

Then again, xserver does _not_ seem to set HAVE_ALIAS to begin with so
one might want to look into that first.

Cc: Adam Jackson <ajax at redhat.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>

---

 configure.ac                         |  9 +--------
 scons/gallium.py                     |  4 ----
 src/glx/glxcmds.c                    |  4 ++--
 src/glx/glxextensions.h              |  4 ++--
 src/mapi/glapi/gen/glX_proto_size.py | 10 ++--------
 src/mapi/glapi/gen/gl_x86_asm.py     |  2 +-
 6 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac
index e6b4d8c..b68b51e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1776,7 +1776,6 @@ if test "x$enable_dri" = xyes; then
     # Platform specific settings and drivers to build
     case "$host_os" in
     linux*)
-        DEFINES="$DEFINES -DHAVE_ALIAS"
         if test "x$enable_dri3" = xyes; then
             DEFINES="$DEFINES -DHAVE_DRI3"
         fi
@@ -1790,19 +1789,13 @@ if test "x$enable_dri" = xyes; then
             ;;
         esac
         ;;
-    *freebsd* | dragonfly* | *netbsd* | openbsd*)
-        DEFINES="$DEFINES -DHAVE_ALIAS"
-        ;;
-    gnu*)
-        DEFINES="$DEFINES -DHAVE_ALIAS"
-        ;;
     cygwin*)
         if test "x$with_dri_drivers" = "xyes"; then
             with_dri_drivers="swrast"
         fi
         ;;
     darwin*)
-        DEFINES="$DEFINES -DGLX_ALIAS_UNSUPPORTED -DBUILDING_MESA"
+        DEFINES="$DEFINES -DBUILDING_MESA"
         if test "x$with_dri_drivers" = "xyes"; then
             with_dri_drivers="swrast"
         fi
diff --git a/scons/gallium.py b/scons/gallium.py
index dc7fdce..767766f 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -323,10 +323,6 @@ def generate(env):
                 'GLX_DIRECT_RENDERING',
                 'GLX_INDIRECT_RENDERING',
             ]
-        if env['platform'] in ('linux', 'freebsd'):
-            cppdefines += ['HAVE_ALIAS']
-        else:
-            cppdefines += ['GLX_ALIAS_UNSUPPORTED']
 
         if env['platform'] in ('linux', 'darwin'):
             cppdefines += ['HAVE_XLOCALE_H']
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 8980de3..7266b58 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2664,7 +2664,7 @@ _GLX_PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
  * \sa glXGetProcAddressARB
  */
 _GLX_PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void)
-#if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
+# ifdef HAVE_FUNC_ATTRIBUTE_ALIAS
 # if defined(USE_MGL_NAMESPACE)
    __attribute__ ((alias("mglXGetProcAddressARB")));
 # else
@@ -2674,7 +2674,7 @@ _GLX_PUBLIC void (*glXGetProcAddress(const GLubyte * procName)) (void)
 {
    return glXGetProcAddressARB(procName);
 }
-#endif /* __GNUC__ */
+#endif /* HAVE_FUNC_ATTRIBUTE_ALIA */
 
 
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
index 6a67006..21ad02a 100644
--- a/src/glx/glxextensions.h
+++ b/src/glx/glxextensions.h
@@ -281,7 +281,7 @@ typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
 
 /* GLX_ALIAS should be used for functions with a non-void return type.
    GLX_ALIAS_VOID is for functions with a void return type. */
-# if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
+# ifdef HAVE_FUNC_ATTRIBUTE_ALIAS
 /* GLX_ALIAS and GLX_ALIAS_VOID both expand to the macro GLX_ALIAS2. Using the
  * extra expansion means that the name mangling macros in glx_mangle.h will
  * apply before stringification, so the alias attribute will have a string like
@@ -300,7 +300,7 @@ typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
 #  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
    void  real_func  proto_args                                      \
    { aliased_func args ; }
-# endif /* __GNUC__ */
+# endif /* HAVE_FUNC_ATTRIBUTE_ALIAS */
 
 #ifdef __cplusplus
 }
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 3a1c554..d9f95a3 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -330,10 +330,7 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
         self.printFastcall()
         print ''
         print ''
-        print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)'
-        print '#  undef HAVE_ALIAS'
-        print '#endif'
-        print '#ifdef HAVE_ALIAS'
+        print '#ifdef HAVE_FUNC_ATTRIBUTE_ALIAS'
         print '#  define ALIAS2(from,to) \\'
         print '    _X_INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
         print '        __attribute__ ((alias( # to )));'
@@ -452,10 +449,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
         print '#include "indirect_size.h"'
         print '#include "indirect_reqsize.h"'
         print ''
-        print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
-        print '#  undef HAVE_ALIAS'
-        print '#endif'
-        print '#ifdef HAVE_ALIAS'
+        print '#ifdef HAVE_FUNC_ATTRIBUTE_ALIAS'
         print '#  define ALIAS2(from,to) \\'
         print '    GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \\'
         print '        __attribute__ ((alias( # to )));'
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index c0c7941..50b09f5 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -120,7 +120,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
         print '\tJMP(GL_OFFSET(off))'
         print '#endif'
         print ''
-        print '#ifdef HAVE_ALIAS'
+        print '#ifdef HAVE_FUNC_ATTRIBUTE_ALIAS'
         print '#  define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
         print '\t.globl\tGL_PREFIX(fn, fn_alt) ;\t\t\t\\'
         print '\t.set\tGL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt)'




More information about the mesa-commit mailing list