HomeFreeBSD

libc++: fix compiling <locale> with -fmodules

Description

libc++: fix compiling <locale> with -fmodules

In /usr/include/c++/v1/__locale_dir/locale_base_api.h, xlocale.h is
included without first including stdio.h and stdlib.h, which causes
functions like strtoll_l() or sscanf_l() to not be declared.

When compiling with -fmodules, locale_base_api.h is processed separately
due to a declaration in /usr/include/c++/v1/module.modulemap, and this
will cause errors due to the above undeclared symbols.

Meanwhile, upstream has substantially reorganized this part of libc++'s
headers, so apply a minimalistic workaround: specifically when compiling
with -fmodules, add includes of stdio.h and stdlib.h.

PR: 286342
MFC after: 1 week

Details

Provenance
Jordan Gordeev <jgopensource@proton.me>Authored on May 18 2025, 7:55 PM
dimCommitted on May 18 2025, 8:04 PM
Parents
rGa8aaf8039f2d: cp: Avoid closing an invalid file descriptor.
Branches
Unknown
Tags
Unknown