[Bug 297629] lang/gcc17-devel: fix build after base d08296c7ab0d

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 17 Aug 2026 21:53:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297629

            Bug ID: 297629
           Summary: lang/gcc17-devel: fix build after base d08296c7ab0d
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: salvadore@freebsd.org
          Reporter: dim@FreeBSD.org
          Assignee: salvadore@freebsd.org
             Flags: maintainer-feedback?(salvadore@freebsd.org)

After base d08296c7ab0d7bb259bf7b8cdf9ffb819c1929ab ("libc: Implement
qualifier-preserving standard library functions"), lang/gcc17-devel
fails to build with an error like:

  In file included from
/wrkdirs/usr/ports/lang/gcc17-devel/work/.build/gcc/include-fixed/stdio.h:52,
                   from cp-demangle.c:109:
 
/wrkdirs/usr/ports/lang/gcc17-devel/work/gcc-17-20260727/libstdc++-v3/../include/libiberty.h:225:14:
error: expected identifier or '(' before '_Generic'
    225 | extern void *memrchr(const void *, int, size_t);
        |              ^~~~~~~

This is because memrchr is now a macro, similar to the other functions
in <string.h>, and libiberty.h attempts to incorrectly redeclare it.

In turn, 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.