Bug 110709 - g_glxglvnddispatchfuncs.c and glxglvnd.c fail to build with clang 8.0
Summary: g_glxglvnddispatchfuncs.c and glxglvnd.c fail to build with clang 8.0
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: 19.1
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-19 13:55 UTC by Bernhard Rosenkraenzer
Modified: 2019-06-20 16:28 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch applying the workarounds mentioned in the bug description (1.58 KB, patch)
2019-05-19 16:25 UTC, Bernhard Rosenkraenzer
Details | Splinter Review

Description Bernhard Rosenkraenzer 2019-05-19 13:55:14 UTC
Trying to build mesa 19.1.0-rc2 with clang 8.0 results in

../src/glx/g_glxglvnddispatchfuncs.c:146:47: error: passing 'const int *' to parameter of type 'int *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    ret = (*pChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
                                              ^~~~~~~~~~~
../src/glx/g_glxglvnddispatchfuncs.c:237:64: error: passing 'const int *' to parameter of type 'int *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    ret = (*pCreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
                                                               ^~~~~~~~~~~
2 errors generated.


After "fixing" this by explicitly casting attrib_list to (int*), a similar error occurs in glxglvnd.c:

../src/glx/glxglvnd.c:44:12: error: returning 'const void *const' from a function with result type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    return __glXDispatchFunctions[internalIndex];
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


This, too, can be "fixed" with an explicit cast to void* -- but of course that's just hiding const-ness being thrown away.

The resulting mesa works fine.
Comment 1 Bernhard Rosenkraenzer 2019-05-19 16:25:26 UTC
Created attachment 144302 [details] [review]
Patch applying the workarounds mentioned in the bug description
Comment 2 Sergey Kondakov 2019-06-13 02:21:40 UTC
Thanks for the patch, it helped me to build with clang 7.0.1 too.

Why is this not in the release ? Do they not read their bug-tracker any more ?
Comment 3 Eric Engestrom 2019-06-14 14:33:46 UTC
We do read the bug tracker, but sometimes things slip through :)

I've sent an MR with a fix here:
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1103

It will be included in the next releases (19.1.1 and 19.0.7) once it's merged.
Comment 4 Sergey Kondakov 2019-06-14 15:20:38 UTC
(In reply to Eric Engestrom from comment #3)
> We do read the bug tracker, but sometimes things slip through :)
> 
> I've sent an MR with a fix here:
> https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1103
> 
> It will be included in the next releases (19.1.1 and 19.0.7) once it's
> merged.

Thanks !

When Bugzilla has gone offline (while dropping spam-messages from bots beforehand on some long-ignored entries) and gitlab have disabled creation of Mesa issues I became sure that FDo Bugzilla will not be coming online at all because Mesa devs have decided to go the way of GCC which would not be surprising with things like bugs #41115 and #23705
Googling this up after failed build was a pleasant surprise.
Comment 5 Eric Engestrom 2019-06-20 16:28:38 UTC
Fixed by:

commit 65b016b1469574ab2e3b4d2c2706fd96c995fa9f
Author: Eric Engestrom <eric.engestrom@intel.com>
Date:   Fri Jun 14 15:15:10 2019 +0100

    glx: fix glvnd pointer types
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110709
    Fixes: 22a9e00aab66d3dd6890 ("glx: Implement the libglvnd interface.")
    Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.