From: Khem Raj <[email protected]>

shader_runner assigns the result of strchr() on a const string to a
non-const pointer, which clang rejects now that glibc's strchr()
preserves const. Add a patch to declare the pointer const.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <[email protected]>
---
 ...ader_runner-Keep-strchr-result-const.patch | 31 +++++++++++++++++++
 meta/recipes-graphics/piglit/piglit_git.bb    |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 
meta/recipes-graphics/piglit/piglit/0001-shader_runner-Keep-strchr-result-const.patch

diff --git 
a/meta/recipes-graphics/piglit/piglit/0001-shader_runner-Keep-strchr-result-const.patch
 
b/meta/recipes-graphics/piglit/piglit/0001-shader_runner-Keep-strchr-result-const.patch
new file mode 100644
index 0000000000..3e1a579691
--- /dev/null
+++ 
b/meta/recipes-graphics/piglit/piglit/0001-shader_runner-Keep-strchr-result-const.patch
@@ -0,0 +1,31 @@
+From: Khem Raj <[email protected]>
+Date: Sat, 24 Oct 2026 10:00:00 -0700
+Subject: [PATCH] shader_runner: Keep strchr() result const
+
+The include path parsing walks a const char cursor and stores the
+result of strchr() in a plain char pointer. Since glibc 2.43, strchr()
+preserves the const qualifier of its argument when C23 features are
+enabled, which _GNU_SOURCE does, so clang fails the build:
+
+  tests/shaders/shader_runner.c:1665:10: error: initializing 'char *' with an 
expression of type 'const char *' discards qualifiers 
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
+
+line_end is only read, so declare it const.
+
+Upstream-Status: Submitted 
[https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/1281]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tests/shaders/shader_runner.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
+--- a/tests/shaders/shader_runner.c
++++ b/tests/shaders/shader_runner.c
+@@ -1662,7 +1662,7 @@ leave_state(enum states state, const char *line, const 
char *script_name)
+ 
+               cursor = shader_string;
+               for (unsigned i = 0; i < num_shader_include_paths; i++) {
+-                      char *line_end = strchr(cursor, '\n');
++                      const char *line_end = strchr(cursor, '\n');
+                       unsigned path_len = line_end - cursor - 1;
+                       char *path = malloc(path_len + 1);
+                       path[path_len] = '\0';
diff --git a/meta/recipes-graphics/piglit/piglit_git.bb 
b/meta/recipes-graphics/piglit/piglit_git.bb
index 8f02496b4f..9fe29c8192 100644
--- a/meta/recipes-graphics/piglit/piglit_git.bb
+++ b/meta/recipes-graphics/piglit/piglit_git.bb
@@ -11,6 +11,7 @@ SRC_URI = 
"git://gitlab.freedesktop.org/mesa/piglit.git;protocol=https;branch=ma
            
file://0003-tests-util-piglit-shader.c-do-not-hardcode-build-pat.patch \
            
file://0001-CMakeLists.txt-do-not-obtain-wayland-scanner-path-fr.patch \
            file://0001-tests-no_error.py-modify-_command-and-not-command.patch 
\
+           file://0001-shader_runner-Keep-strchr-result-const.patch \
            "
 UPSTREAM_CHECK_COMMITS = "1"
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#248596): 
https://lists.openembedded.org/g/openembedded-core/message/248596
Mute This Topic: https://lists.openembedded.org/mt/121917111/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to