https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286342

--- Comment #7 from Jordan Gordeev <jgopensou...@proton.me> ---
Created attachment 260449
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=260449&action=edit
A fix for the problem

I'm attaching a patch that fixes the problem.

Here is my analysis of the problem:
The libc++ header <locale> needs symbols like strtoll_l() or sscanf_l().
The header file <xlocale.h> provides those symbols if it is included *after*
<stdio.h> and <stdlib.h>.

When compiling without clang modules (which is the default), the header
<locale> includes many other headers which transitively include <stdio.h> and
<stdlib.h>. So, when the line in <locale> that includes <xlocale.h> is reached,
the necessary prerequisite headers have already been included.

When compiling with clang modules the header <xlocale.h> is included from two
submodules. The inclusion in /usr/include/c++/v1/__locale_dir/locale_base_api.h
is done without first including <stdio.h> and <stdlib.h> and therefore doesn't
provide the necessary symbols. The inclusion in <locale> is considered a
semantic import of the submodule defined by __locale_dir/locale_base_api.h.

If you remove the include line for <xlocale.h> from
__locale_dir/locale_base_api.h, the header <xlocale.h> will no longer be
considered as belonging to the submodule defined by
__locale_dir/locale_base_api.h and the include for <xlocale.h> in <locale> will
properly provide the necessary symbols.

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

Reply via email to