From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/688 Path: news.gmane.org!not-for-mail From: Isaac Dunham Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] _BSD_SOURCE in math.h; MAXFLOAT is XOPEN only Date: Thu, 5 Apr 2012 22:32:27 -0700 Message-ID: <20120405223227.4d1ecb2b@newbook> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/lSxoCL6c8.wAw2ByxQr4z8I" X-Trace: dough.gmane.org 1333690364 25574 80.91.229.3 (6 Apr 2012 05:32:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Apr 2012 05:32:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-689-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 06 07:32:44 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SG1mu-0006Oo-7A for gllmg-musl@plane.gmane.org; Fri, 06 Apr 2012 07:32:44 +0200 Original-Received: (qmail 6008 invoked by uid 550); 6 Apr 2012 05:32:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5996 invoked from network); 6 Apr 2012 05:32:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=xttGyqrqI0FzKdo2ibJ3hb/mpwG+WpgvAXtdmdI7rnOHkau8EwdMV0dhpUApgfxYF96jZHeA4mqiV2qSc6spkmyhuRzdcKXZGiG7gB67up//Kc+ZfA/kWDzA7cQYAy3xpYydPBLu+dLcW/8oZ8WzkWMAuAI4TeiZht7u6Z7DfDs=; h=Date:From:To:Subject:Message-ID:X-Mailer:Mime-Version:Content-Type; X-Mailer: Claws Mail 3.7.4 (GTK+ 2.20.1; i486-pc-linux-gnu) Xref: news.gmane.org gmane.linux.lib.musl.general:688 Archived-At: --MP_/lSxoCL6c8.wAw2ByxQr4z8I Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 _USE_SVID is not defined (I'm not copy-pasting here, I cleaned it up): #ifdef _USE_SVID //defined as 1 if _GNU_SOURCE is .. # define HUGE //Same value as MAXFLOAT #else #ifdef _XOPEN_SOURCE # define MAXFLOAT //ifndef _USE_SVID #endif #endif //SVID So I moved it so _GNU_SOURCE doesn't add it, and I added HUGE to _GNU_SOURCE... Isaac Dunham --MP_/lSxoCL6c8.wAw2ByxQr4z8I Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=math.diff diff --git a/include/math.h b/include/math.h index ff62cb7..85ef634 100644 --- a/include/math.h +++ b/include/math.h @@ -330,8 +330,7 @@ double trunc(double); float truncf(float); long double truncl(long double); -#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) -#define MAXFLOAT 3.40282347e+38F +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define M_E 2.7182818284590452354 /* e */ #define M_LOG2E 1.4426950408889634074 /* log_2 e */ #define M_LOG10E 0.43429448190325182765 /* log_10 e */ @@ -345,7 +344,13 @@ long double truncl(long double); #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif +#if defined(_XOPEN_SOURCE) +#define MAXFLOAT 3.40282347e+38F +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) extern int signgam; double j0(double); @@ -358,6 +363,7 @@ double yn(int, double); #endif #ifdef _GNU_SOURCE +#define HUGE 3.40282347e+38F double scalb(double, double); float scalbf(float, float); long double scalbl(long double, long double); --MP_/lSxoCL6c8.wAw2ByxQr4z8I--