This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] define M_PI etc. if _XOPEN_SOURCE is defined appropriately
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: newlib at sourceware dot org
- Date: Thu, 31 Jul 2014 14:41:33 +0100
- Subject: Re: [PATCH] define M_PI etc. if _XOPEN_SOURCE is defined appropriately
- Authentication-results: sourceware.org; auth=none
- References: <53D8F928 dot 9070901 at dronecode dot org dot uk> <53D8FD50 dot 1020907 at dronecode dot org dot uk> <20140730141906 dot GN25860 at calimero dot vinschen dot de>
On 30/07/2014 15:19, Corinna Vinschen wrote:
On Jul 30 15:12, Jon TURNEY wrote:
On 30/07/2014 14:54, Jon TURNEY wrote:
math.h only defines M_PI and similar constants if __STRICT_ANSI__ is not
SUSv2 specifies that math.h should define some of these constants .
Attached is a patch to also define these constants if _XOPEN_SOURCE is
So bad :-(
This patch doesn't correctly handle the case where _XOPEN_SOURCE is defined
as the empty string. Amended patch attached.
You can workaround that by using the definition of __XSI_VISIBLE
from <sys/cdefs.h>. It's always defined and non-empty.
Yes, that seems a much better way of doing things.
However, in my testing, __XSI_VISIBLE seems to be defined by line 704 in
cdefs.h with just -std=c99, which doesn't seem right.