diff mbox

stdlib/tst-strtod-round.c: Fix build on ARM

Message ID 1410903170-31206-2-git-send-email-will.newton@linaro.org
State Accepted
Commit dc6fe23ba65714781a3d26270c132c0ca0ca5beb
Headers show

Commit Message

Will Newton Sept. 16, 2014, 9:32 p.m. UTC
Building this test on ARM fails because the prototypes for the long
double variants of the math functions are unavailable.

Add an additional include guard to math.h that enables long double math
function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
stdlib/tst-strtod-round.c.

ChangeLog:

2014-09-16  Will Newton  <will.newton@linaro.org>

	* math/math.h: Define long double math functions if
	_LIBC_TEST is defined.
	* stdlib/tst-strtod-round.c: Define _LIBC_TEST.
---
 math/math.h               | 2 +-
 stdlib/tst-strtod-round.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Will Newton Sept. 24, 2014, 2:38 p.m. UTC | #1
On 16 September 2014 14:32, Will Newton <will.newton@linaro.org> wrote:
> Building this test on ARM fails because the prototypes for the long
> double variants of the math functions are unavailable.
>
> Add an additional include guard to math.h that enables long double math
> function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
> stdlib/tst-strtod-round.c.
>
> ChangeLog:
>
> 2014-09-16  Will Newton  <will.newton@linaro.org>
>
>         * math/math.h: Define long double math functions if
>         _LIBC_TEST is defined.
>         * stdlib/tst-strtod-round.c: Define _LIBC_TEST.
> ---
>  math/math.h               | 2 +-
>  stdlib/tst-strtod-round.c | 3 +++
>  2 files changed, 4 insertions(+), 1 deletion(-)

Ping?

> diff --git a/math/math.h b/math/math.h
> index 72ec2ca..dc7ab2d 100644
> --- a/math/math.h
> +++ b/math/math.h
> @@ -91,7 +91,7 @@ __BEGIN_DECLS
>  # undef _Mdouble_END_NAMESPACE
>  # undef        __MATH_PRECNAME
>
> -# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \
> +# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC && !defined _LIBC_TEST) \
>       || defined __LDBL_COMPAT
>  #  ifdef __LDBL_COMPAT
>
> diff --git a/stdlib/tst-strtod-round.c b/stdlib/tst-strtod-round.c
> index f334b20..cbde457 100644
> --- a/stdlib/tst-strtod-round.c
> +++ b/stdlib/tst-strtod-round.c
> @@ -17,6 +17,9 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>
> +/* Defining _LIBC_TEST ensures long double math functions are
> +   declared in the headers.  */
> +#define _LIBC_TEST 1
>  #include <fenv.h>
>  #include <float.h>
>  #include <math.h>
> --
> 1.9.3
>
Siddhesh Poyarekar Sept. 24, 2014, 2:59 p.m. UTC | #2
On Tue, Sep 16, 2014 at 02:32:50PM -0700, Will Newton wrote:
> Building this test on ARM fails because the prototypes for the long
> double variants of the math functions are unavailable.
> 
> Add an additional include guard to math.h that enables long double math
> function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
> stdlib/tst-strtod-round.c.
> 
> ChangeLog:
> 
> 2014-09-16  Will Newton  <will.newton@linaro.org>
> 
> 	* math/math.h: Define long double math functions if
> 	_LIBC_TEST is defined.
> 	* stdlib/tst-strtod-round.c: Define _LIBC_TEST.
> ---
>  math/math.h               | 2 +-
>  stdlib/tst-strtod-round.c | 3 +++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/math/math.h b/math/math.h
> index 72ec2ca..dc7ab2d 100644
> --- a/math/math.h
> +++ b/math/math.h
> @@ -91,7 +91,7 @@ __BEGIN_DECLS
>  # undef _Mdouble_END_NAMESPACE
>  # undef	__MATH_PRECNAME
>  
> -# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \
> +# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC && !defined _LIBC_TEST) \

Wouldn't it be nicer to read with:

  # if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC)
        || defined _LIBC_TEST
	|| defined __LDBL_COMPAT
	...

The double negation looks a bit ugly to me.  Looks OK otherwise.

Siddhesh
Siddhesh Poyarekar Sept. 24, 2014, 3:03 p.m. UTC | #3
On Wed, Sep 24, 2014 at 08:29:15PM +0530, Siddhesh Poyarekar wrote:
> On Tue, Sep 16, 2014 at 02:32:50PM -0700, Will Newton wrote:
> > Building this test on ARM fails because the prototypes for the long
> > double variants of the math functions are unavailable.
> > 
> > Add an additional include guard to math.h that enables long double math
> > function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
> > stdlib/tst-strtod-round.c.
> > 
> > ChangeLog:
> > 
> > 2014-09-16  Will Newton  <will.newton@linaro.org>
> > 
> > 	* math/math.h: Define long double math functions if
> > 	_LIBC_TEST is defined.
> > 	* stdlib/tst-strtod-round.c: Define _LIBC_TEST.

Oh, and this needs a BZ.

Siddhesh
Joseph Myers Sept. 24, 2014, 3:13 p.m. UTC | #4
On Wed, 24 Sep 2014, Siddhesh Poyarekar wrote:

> On Wed, Sep 24, 2014 at 08:29:15PM +0530, Siddhesh Poyarekar wrote:
> > On Tue, Sep 16, 2014 at 02:32:50PM -0700, Will Newton wrote:
> > > Building this test on ARM fails because the prototypes for the long
> > > double variants of the math functions are unavailable.
> > > 
> > > Add an additional include guard to math.h that enables long double math
> > > function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
> > > stdlib/tst-strtod-round.c.
> > > 
> > > ChangeLog:
> > > 
> > > 2014-09-16  Will Newton  <will.newton@linaro.org>
> > > 
> > > 	* math/math.h: Define long double math functions if
> > > 	_LIBC_TEST is defined.
> > > 	* stdlib/tst-strtod-round.c: Define _LIBC_TEST.
> 
> Oh, and this needs a BZ.

I don't see why - it's not a bug that was user-visible in a release.  
User programs, which should never define _LIBC or _LIBC_TEST, will have 
got the required declarations anyway.
Siddhesh Poyarekar Sept. 24, 2014, 3:19 p.m. UTC | #5
On Wed, Sep 24, 2014 at 03:13:17PM +0000, Joseph S. Myers wrote:
> I don't see why - it's not a bug that was user-visible in a release.  
> User programs, which should never define _LIBC or _LIBC_TEST, will have 
> got the required declarations anyway.

There's a build component in bugzilla that exists for exactly such
bugs.  It could be argued that it's a test failure and not a build
failure, but then most distributions (and people) have the test run as
part of their workflow and a test failure may in some cases result in
a build failure.

Siddhesh
Joseph Myers Sept. 24, 2014, 3:28 p.m. UTC | #6
On Wed, 24 Sep 2014, Siddhesh Poyarekar wrote:

> On Wed, Sep 24, 2014 at 03:13:17PM +0000, Joseph S. Myers wrote:
> > I don't see why - it's not a bug that was user-visible in a release.  
> > User programs, which should never define _LIBC or _LIBC_TEST, will have 
> > got the required declarations anyway.
> 
> There's a build component in bugzilla that exists for exactly such
> bugs.  It could be argued that it's a test failure and not a build
> failure, but then most distributions (and people) have the test run as
> part of their workflow and a test failure may in some cases result in
> a build failure.

But it's not a test failure in a release either (and the point of filing a 
bug when fixing it is for users of releases to be able to find fixed bugs 
when searching Bugzilla; anyone using git master should be following 
libc-alpha).  It's build warnings (the functions get the right types 
anyway, being built-in).  The use of -Werror=implicit-function-declaration 
postdates the last release.
Siddhesh Poyarekar Sept. 24, 2014, 3:32 p.m. UTC | #7
On 24 September 2014 20:58, Joseph S. Myers <joseph@codesourcery.com> wrote:
> But it's not a test failure in a release either (and the point of filing a
> bug when fixing it is for users of releases to be able to find fixed bugs
> when searching Bugzilla; anyone using git master should be following
> libc-alpha).  It's build warnings (the functions get the right types
> anyway, being built-in).  The use of -Werror=implicit-function-declaration
> postdates the last release.

Ah, of course.  Never mind then.

Thanks,
Siddhesh
diff mbox

Patch

diff --git a/math/math.h b/math/math.h
index 72ec2ca..dc7ab2d 100644
--- a/math/math.h
+++ b/math/math.h
@@ -91,7 +91,7 @@  __BEGIN_DECLS
 # undef _Mdouble_END_NAMESPACE
 # undef	__MATH_PRECNAME
 
-# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \
+# if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC && !defined _LIBC_TEST) \
      || defined __LDBL_COMPAT
 #  ifdef __LDBL_COMPAT
 
diff --git a/stdlib/tst-strtod-round.c b/stdlib/tst-strtod-round.c
index f334b20..cbde457 100644
--- a/stdlib/tst-strtod-round.c
+++ b/stdlib/tst-strtod-round.c
@@ -17,6 +17,9 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* Defining _LIBC_TEST ensures long double math functions are
+   declared in the headers.  */
+#define _LIBC_TEST 1
 #include <fenv.h>
 #include <float.h>
 #include <math.h>