From c930daf7051b4bf7e2a9f4ce29e5e447100f200a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 22 Nov 2025 15:52:23 -0800 Subject: [PATCH] glx: fix const qualifier warnings found with C23 glibc support glibc master has been C23'fying the functions which is resulting errors Several functions assigned results of bsearch/strstr/strpbrk/memchr to non-const pointers, triggering -Wincompatible-pointer-types-discards-qualifiers under clang/gcc with -Werror. Cast bsearch return values where needed and propagate const correctness for strstr/strpbrk/memchr results. Removes build failures with strict warning flags without changing behavior. Signed-off-by: Khem Raj [Eric: changed the glxglvnd.c hunk to add the missing `const` instead of casting it away] Cc: mesa-stable (cherry picked from commit 268e19378fc03c68e897c15b5f06c747bbc9387c) Part-of: --- .pick_status.json | 2 +- src/glx/clientinfo.c | 2 +- src/glx/glxglvnd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f7c0e039202..eda3ee27038 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1144,7 +1144,7 @@ "description": "glx: fix const qualifier warnings found with C23 glibc support", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/glx/clientinfo.c b/src/glx/clientinfo.c index 14e0e44a832..b3d4f312a34 100644 --- a/src/glx/clientinfo.c +++ b/src/glx/clientinfo.c @@ -129,7 +129,7 @@ glxSendClientInfo(struct glx_display *glx_dpy, int screen) const char *haystack = src->serverGLXexts; while (haystack != NULL) { - char *match = strstr(haystack, "GLX_ARB_create_context"); + const char *match = strstr(haystack, "GLX_ARB_create_context"); if (match == NULL) break; diff --git a/src/glx/glxglvnd.c b/src/glx/glxglvnd.c index bf5c2a06b0c..7cb16444356 100644 --- a/src/glx/glxglvnd.c +++ b/src/glx/glxglvnd.c @@ -26,7 +26,7 @@ compare(const void *l, const void *r) static unsigned FindGLXFunction(const GLubyte *name) { - const char **match; + const char * const *match; match = bsearch(name, __glXDispatchTableStrings, DI_FUNCTION_COUNT, sizeof(const char *), compare);