[Bug 271808] -D_POSIX_C_SOURCE=200809L shadows visibility of M_PI from math.h

[email protected] Fri, 22 May 2026 04:23:32 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271808

Mark Millard <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from Mark Millard <[email protected]> ---
(In reply to Mark Linimon from comment #3)

(Basically an expanded comment #2.)

POSIX 2026 indicates:

"Some of the functionality described on this reference page
extends the ISO C standard. Applications shall define the
appropriate feature test macro (see XSH 2.2 The Compilation
Environment) to enable the visibility of these symbols in
this header."

It defines how _POSIX_C_SOURCE and _XOPEN_SOURCE are to be
used for POSIX 2026 to, for example, control what ends up
being defined beyond what is in the C/C++ standards.

Other vintages of POSIX do similarly, per vintage, including
POSIX 2008.

The test program used with just -D_POSIX_C_SOURCE=3D200809L is
not conformant with those rules of use if M_PI is to be
defined.


# cc -std=3Dc99 -D_POSIX_C_SOURCE=3D200809L -D_XOPEN_SOURCE=3D700 M_PI_posi=
x.c
# ./a.out
M_PI=3D3.141593


So: Not a bug --because the example is not as POSIX 2008 requires
for M_PI to end up being defined.

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