Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 2021 00:40:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 257827] Providing _POSIX_C_SOURCE causes some C++ headers to fail
Message-ID:  <bug-257827-99@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257827

            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=3Dc++98 -D_POSIX_C_SOURCE=3D200112L 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) !=3D0 :
false;
               ^
/usr/include/c++/v1/__locale:638:22: error: use of undeclared identifier
'isascii'
            *__vec =3D 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 intern=
al
version of isascii(), e.g. __isascii(), which can be exposed no matter what
(since it's a reserved identifier).

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-257827-99>