[Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 14 Aug 2021 00:40:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257827 Bug ID: 257827 Summary: Providing _POSIX_C_SOURCE causes some C++ headers to fail Product: Base System Version: 13.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: standards Assignee: standards@FreeBSD.org Reporter: cspiegel@gmail.com Consider the following C++ program: ``` #include <iostream> int main(void) { return 0; } ``` Build: ``` $ c++ -std=c++98 -D_POSIX_C_SOURCE=200112L t.cpp In file included from /home/chris/t.cpp:1: In file included from /usr/include/c++/v1/iostream:37: In file included from /usr/include/c++/v1/ios:215: /usr/include/c++/v1/__locale:631:16: error: use of undeclared identifier 'isascii' return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false; ^ /usr/include/c++/v1/__locale:638:22: error: use of undeclared identifier 'isascii' *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0; ^ /usr/include/c++/v1/__locale:646:17: error: use of undeclared identifier 'isascii' if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) ^ /usr/include/c++/v1/__locale:655:19: error: use of undeclared identifier 'isascii' if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) ^ 4 errors generated. ``` The problem (as far as I can tell) is that isascii() is an XSI extension, so will not be exposed unless _XOPEN_SOURCE is set. But then __locale directly calls isascii(), inadvertently requiring the user to set things up so that it's exposed. I think the proper solution would be for __locale to use an internal version of isascii(), e.g. __isascii(), which can be exposed no matter what (since it's a reserved identifier). -- You are receiving this mail because: You are the assignee for the bug.