[Mesa-dev] [PATCH 1/2] glx: Fix build errors with --enable-mangling.

Kyle Brenneman kbrenneman at nvidia.com
Mon Sep 28 11:09:07 PDT 2015


On 09/28/2015 11:26 AM, Emil Velikov wrote:
> Hi Kyle,
>
> On 24 September 2015 at 23:22, Kyle Brenneman <kbrenneman at nvidia.com> wrote:
>> Rearranged the GLX_ALIAS macro in glextensions.h so that it will pick up
>> the renames from glx_mangle.h.
>>
>> Fixed the alias attribute for glXGetProcAddress when USE_MGL_NAMESPACE is
>> defined.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55552
> Thanks for fixing this. It has been broken for ages.
>
> Can you please add your s-o-b line as well as
> Cc: "10.6 11.0" <mesa-stable at lists.freedesktop.org>
>
>> ---
>>   src/glx/glxcmds.c       | 4 ++++
>>   src/glx/glxextensions.h | 6 ++++--
>>   2 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
>> index 8164cd9..976ee36 100644
>> --- a/src/glx/glxcmds.c
>> +++ b/src/glx/glxcmds.c
>> @@ -2666,7 +2666,11 @@ _X_EXPORT void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
>>    */
>>   _X_EXPORT void (*glXGetProcAddress(const GLubyte * procName)) (void)
>>   #if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
>> +# if defined(USE_MGL_NAMESPACE)
>> +   __attribute__ ((alias("mglXGetProcAddressARB")));
>> +# else
>>      __attribute__ ((alias("glXGetProcAddressARB")));
>> +# endif
>>   #else
>>   {
>>      return glXGetProcAddressARB(procName);
>> diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
>> index 8436a94..c4d4a17 100644
>> --- a/src/glx/glxextensions.h
>> +++ b/src/glx/glxextensions.h
>> @@ -279,11 +279,13 @@ typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
>>   # define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func)
>>   #else
>>   # if defined(__GNUC__) && !defined(GLX_ALIAS_UNSUPPORTED)
>> -#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
>> +#  define GLX_ALIAS2(return_type, real_func, proto_args, args, aliased_func) \
>>      return_type  real_func  proto_args                                   \
>>      __attribute__ ((alias( # aliased_func ) ));
>> +#  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
>> +   GLX_ALIAS2(return_type, real_func, proto_args, args, aliased_func)
>>   #  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
>> -   GLX_ALIAS(void, real_func, proto_args, args, aliased_func)
>> +   GLX_ALIAS2(void, real_func, proto_args, args, aliased_func)
> I'm having some serious eye-hurt with these lovely macros and for the
> sake of me cannot see how this works. Are re undefining GLX_ALIAS
> elsewhere ?
No, it uses an extra layer of expansion. The GLX_ALIAS macro expands to 
to GLX_ALIAS2, which in turn expands to the declaration with the alias 
attribute. That extra expansion means that the string will pick up the 
macros in glx_mangle.h. With only a single expansion, 
glXGetCurrentDisplayEXT would expand to use the string 
"glXGetCurrentDisplay", but with two, it gets "mglXGetCurrentDisplay".

That's also why GLX_ALIAS_VOID worked before but GLX_ALIAS didn't.

Anyway, I added a comment next to them to clarify why it uses the nested 
macros. Hopefully that makes it easier to read.
>
> As a follow-up one can check, if we can remove the alias-unsupported
> case and alternatively unify HAVE_ALIAS and GLX_ALIAS_UNSUPPORTED, and
> use them consistently. Neither one is obviously obviously criteria for
> this patch's acceptable :-)
>
> Thanks
> Emil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150928/c4f7e95b/attachment.html>


More information about the mesa-dev mailing list