git: 955eda5e75ec - main - lang/gcc15: fix build after base d08296c7ab0d
Dimitry Andric <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.ports |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/ports/commit/?id=955eda5e75ec2f2c177de7005b3b952d9593b7f4 commit 955eda5e75ec2f2c177de7005b3b952d9593b7f4 Author: Dimitry Andric <[email protected]> AuthorDate: 2026-08-16 20:16:16 +0000 Commit: Dimitry Andric <[email protected]> CommitDate: 2026-08-17 19:41:13 +0000 lang/gcc15: fix build after base d08296c7ab0d After base d08296c7ab0d7bb259bf7b8cdf9ffb819c1929ab ("libc: Implement qualifier-preserving standard library functions"), lang/gcc15 fails to build with errors like: /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.2.0/libgomp/affinity-fmt.c: In function 'gomp_display_affinity': /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.2.0/libgomp/affinity-fmt.c:330:25: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 330 | char *q = strchr (p + 1, '}'); | ^~~~~~ and: In file included from /wrkdirs/usr/ports/lang/gcc15/work/.build/gcc/include-fixed/stdio.h:52, from cp-demangle.c:109: /wrkdirs/usr/ports/lang/gcc15/work/gcc-15.2.0/libstdc++-v3/../include/libiberty.h:225:14: error: expected identifier or '(' before '_Generic' 225 | extern void *memrchr(const void *, int, size_t); | ^~~~~~~ The former is because strchr with a 'const char *' input now returns a 'const char*'. This is easily fixed by making 'q' a 'const char *' too. The latter is because memrchr is now a macro, similar to the other functions in <string.h>, and libiberty.h attempts to incorrectly redeclare it. This is because cp-demangle.c includes libiberty.h, but does not include the config.h generated for libiberty.h, instead using the config.h generated for libstdc++. The problem is really with the way upstream creates its config.h headers: they should either make libiberty.h automatically include its own config.h file, or rename that one to libiberty-config.h, so it can be included at the same time as the libstdc++ config.h header. The easiest way to fix it is to add a '!defined(__FreeBSD__)' conditional to the #if statement that attempts to declare the incompatible memrchr. Approved by: salvadore (maintainer) PR: 297601 MFH: 2026Q3 --- lang/gcc15/files/patch-include_libiberty.h | 11 +++++++++++ lang/gcc15/files/patch-libgomp_affinity-fmt.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/lang/gcc15/files/patch-include_libiberty.h b/lang/gcc15/files/patch-include_libiberty.h new file mode 100644 index 000000000000..c082051d9f88 --- /dev/null +++ b/lang/gcc15/files/patch-include_libiberty.h @@ -0,0 +1,11 @@ +--- include/libiberty.h.orig 2025-08-08 06:51:44 UTC ++++ include/libiberty.h +@@ -221,7 +221,7 @@ extern int mkstemps(char *, int); + + /* Make memrchr available on systems that do not have it. */ + #if !defined (__GNU_LIBRARY__ ) && !defined (__linux__) && \ +- !defined (HAVE_MEMRCHR) ++ !defined (__FreeBSD__) && !defined (HAVE_MEMRCHR) + extern void *memrchr(const void *, int, size_t); + #endif + diff --git a/lang/gcc15/files/patch-libgomp_affinity-fmt.c b/lang/gcc15/files/patch-libgomp_affinity-fmt.c new file mode 100644 index 000000000000..fa3ab1ae484f --- /dev/null +++ b/lang/gcc15/files/patch-libgomp_affinity-fmt.c @@ -0,0 +1,11 @@ +--- libgomp/affinity-fmt.c.orig 2025-08-08 06:51:45 UTC ++++ libgomp/affinity-fmt.c +@@ -327,7 +327,7 @@ gomp_display_affinity (char *buffer, size_t size, + } + if (c == '{') + { +- char *q = strchr (p + 1, '}'); ++ const char *q = strchr (p + 1, '}'); + if (q) + gomp_fatal ("unsupported long type name '%.*s' in affinity " + "format", (int) (q - (p + 1)), p + 1);