Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Khem Raj <khem.raj@oss.qualcomm.com>
Subject: [PATCH 3/3] piglit: Fix build with glibc 2.43+ and clang
Date: Sat, 24 Oct 2026 09:10:33 -0700	[thread overview]
Message-ID: <20261024161033.4140130-3-raj.khem@gmail.com> (raw)
In-Reply-To: <20261024161033.4140130-1-raj.khem@gmail.com>

From: Khem Raj <khem.raj@oss.qualcomm.com>

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 <khem.raj@oss.qualcomm.com>
---
 ...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 <khem.raj@oss.qualcomm.com>
+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 <khem.raj@oss.qualcomm.com>
+---
+ 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"
 

  parent reply	other threads:[~2026-10-24 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 16:10 [PATCH 1/3] consolekit: Upgrade to ConsoleKit2 2.0.0 Khem Raj
2026-10-24 16:10 ` [PATCH 2/3] pulseaudio: Drop x11 requirement for consolekit RDEPENDS Khem Raj
2026-10-24 16:10 ` Khem Raj [this message]
2026-10-28 10:39 ` [OE-core] [PATCH 1/3] consolekit: Upgrade to ConsoleKit2 2.0.0 Ross Burton
2026-10-28 14:21   ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261024161033.4140130-3-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=khem.raj@oss.qualcomm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox