mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <idunham@lavabit.com>
To: musl@lists.openwall.com
Subject: Re: [PATCH] _BSD_SOURCE in math.h; MAXFLOAT is XOPEN only
Date: Fri, 6 Apr 2012 08:26:04 -0700	[thread overview]
Message-ID: <20120406082604.350111dc@newbook> (raw)
In-Reply-To: <20120406131448.GE8803@brightrain.aerifal.cx>

On Fri, 6 Apr 2012 09:14:48 -0400
Rich Felker <dalias@aerifal.cx> wrote:

> On Thu, Apr 05, 2012 at 10:32:27PM -0700, Isaac Dunham wrote:
> > This is pretty minor for the most part.
> > There was one issue I noticed: 
> > _GNU_SOURCE defines MAXFLOAT here, but glibc only defines it if
..
> To clarify the general policy: In musl, _GNU_SOURCE or _BSD_SOURCE
> should not break or remove functionality specified by the actual
> standards. They should just add the missing nonstandard stuff
> associated with GNU or BSD.
The patch does not copy glibc logic, since I agree with that policy:
 
+#if defined(_XOPEN_SOURCE)
+#define MAXFLOAT        3.40282347e+38F
+#endif
+
I agree entirely with not removing functionality when a legacy _SOURCE
macro is defined; but... 
> Further, so far _GNU_SOURCE has been a superset of _XOPEN_SOURCE (i.e.
> anything under defined(_XOPEN_SOURCE) has ||defined(_GNU_SOURCE) with
> it). If it turns out this is a bad idea, I'm not entirely opposed to
> changing that, but just matching the exact set of definitions provided
> by glibc for its own sake is not a good enough reason to change. The
> goal is always compatibility with applications, not matching glibc.

I excluded _GNU_SOURCE in this one case because for some reason, GNU
wants to exclude MAXFLOAT in favor of HUGE--the excerpt:
#else	/* !SVID */
# ifdef __USE_XOPEN
/* X/Open wants another strange constant.  */
#  define MAXFLOAT	3.40282347e+38F
# endif
#endif	/* SVID */
I think that using SVID interfaces in favor of X/Open is brain-damaged,
but I'm not interested in automatically defining something if
_GNU_SOURCE is defined when GNU takes pains to exclude it under the
same conditions; that approach is deliberate breakage.

Unlike glibc, -D_XOPEN_SOURCE -D_GNU_SOURCE still activates the full
X/Open logic with this patch.

Isaac Dunham



      reply	other threads:[~2012-04-06 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06  5:32 Isaac Dunham
2012-04-06 13:14 ` Rich Felker
2012-04-06 15:26   ` Isaac Dunham [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120406082604.350111dc@newbook \
    --to=idunham@lavabit.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).