commit:     7c177734e5e549ae93cdc3d13b3ef106b19b8800
Author:     Haelwenn (lanodan) Monnier <contact <AT> hacktivis <DOT> me>
AuthorDate: Wed Feb 11 13:55:25 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 11 19:39:33 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c177734

sys-devel/cproc: fix C23 const-preserving issue

Closes: https://bugs.gentoo.org/969281
Signed-off-by: Haelwenn (lanodan) Monnier <contact <AT> hacktivis.me>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/42
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/cproc/cproc-0_pre20240413.ebuild         |  6 +++-
 .../cproc/files/cproc-bug969281-const-strchr.patch | 42 ++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/sys-devel/cproc/cproc-0_pre20240413.ebuild 
b/sys-devel/cproc/cproc-0_pre20240413.ebuild
index cb98d7443072..c6980383f86f 100644
--- a/sys-devel/cproc/cproc-0_pre20240413.ebuild
+++ b/sys-devel/cproc/cproc-0_pre20240413.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2021-2024 Gentoo Authors
+# Copyright 2021-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -26,6 +26,10 @@ SLOT="0"
 DEPEND="sys-devel/qbe"
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+       "${FILESDIR}/cproc-bug969281-const-strchr.patch"
+)
+
 src_configure() {
        tc-export CC
 

diff --git a/sys-devel/cproc/files/cproc-bug969281-const-strchr.patch 
b/sys-devel/cproc/files/cproc-bug969281-const-strchr.patch
new file mode 100644
index 000000000000..34bed6a8a8df
--- /dev/null
+++ b/sys-devel/cproc/files/cproc-bug969281-const-strchr.patch
@@ -0,0 +1,42 @@
+From 4e156dc64ddb4a6567ce0239296b2f5966312e22 Mon Sep 17 00:00:00 2001
+From: "Haelwenn (lanodan) Monnier" <[email protected]>
+Date: Wed, 11 Feb 2026 14:13:45 +0100
+Subject: [PATCH cproc] cc.h: Remove const on *file entry of struct location
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+X-Archived-At: https://lists.sr.ht/~mcf/cproc/patches/67569
+
+C23 changed the return type of functions like strchr() from `char*`
+to const-preserving macros (see [N3096] 7.26.5 Search functions).
+
+glibc 2.43+ implemented the change, which leads to this error:
+
+    pp.c: In function ‘directive’:
+    pp.c:345:51: error: assignment of read-only location ‘*(const char 
*)strchr(newloc.file, 34)’
+      345 |                         *strchr(newloc.file, '"') = '\0';
+          |                                                   ^
+
+Upstream bug: https://bugs.gentoo.org/969281
+---
+ cc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cc.h b/cc.h
+index f67c33a..f1995fc 100644
+--- a/cc.h
++++ b/cc.h
+@@ -125,7 +125,7 @@ enum tokenkind {
+ };
+ 
+ struct location {
+-      const char *file;
++      char *file;
+       size_t line, col;
+ };
+ 
+
+base-commit: e963ced5c2b0a102778b19906eaef1af92ed7862
+-- 
+2.52.0
+

Reply via email to