[rtems commit] psxtests: Fix math function build warnings

Joel Sherrill joel at rtems.org
Wed May 5 15:15:27 UTC 2021


Module:    rtems
Branch:    master
Commit:    e5590a3ea1da6bc3e57651b51b8c356d881a60bd
Changeset: http://git.rtems.org/rtems/commit/?id=e5590a3ea1da6bc3e57651b51b8c356d881a60bd

Author:    Stephen Clark <stephen.clark at oarcorp.com>
Date:      Wed Mar 17 17:48:57 2021 -0500

psxtests: Fix math function build warnings

Added conditionals to ensure that long double function tests were only
built when newlib has long double math functions.

---

 testsuites/psxtests/psxhdrs/math/acoshl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/acosl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/asinhl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/asinl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/atan2l.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/atanhl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/atanl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/cbrtl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/ceill.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/copysignl.c       |  3 ++
 testsuites/psxtests/psxhdrs/math/coshl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/cosl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/erfcl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/erfl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/exp2l.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/expl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/expm1l.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/fabsl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/fdiml.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/floorl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/fmal.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/fmaxl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/fminl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/fmodl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/frexpl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/has_long_double.h | 54 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/math/hypotl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/ilogbl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/ldexpl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/lgammal.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/llrintl.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/llroundl.c        |  3 ++
 testsuites/psxtests/psxhdrs/math/log10l.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/log1pl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/log2l.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/logbl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/logl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/lrintl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/lroundl.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/modfl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/nanl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/nearbyintl.c      |  3 ++
 testsuites/psxtests/psxhdrs/math/nextafterl.c      |  3 ++
 testsuites/psxtests/psxhdrs/math/nexttoward.c      |  3 ++
 testsuites/psxtests/psxhdrs/math/nexttowardf.c     |  3 ++
 testsuites/psxtests/psxhdrs/math/nexttowardl.c     |  3 ++
 testsuites/psxtests/psxhdrs/math/powl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/remainderl.c      |  3 ++
 testsuites/psxtests/psxhdrs/math/remquol.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/rintl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/roundl.c          |  3 ++
 testsuites/psxtests/psxhdrs/math/scalblnl.c        |  3 ++
 testsuites/psxtests/psxhdrs/math/scalbnl.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/sinhl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/sinl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/sqrtl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/tanhl.c           |  3 ++
 testsuites/psxtests/psxhdrs/math/tanl.c            |  3 ++
 testsuites/psxtests/psxhdrs/math/tgammal.c         |  3 ++
 testsuites/psxtests/psxhdrs/math/truncl.c          |  3 ++
 60 files changed, 231 insertions(+)

diff --git a/testsuites/psxtests/psxhdrs/math/acoshl.c b/testsuites/psxtests/psxhdrs/math/acoshl.c
index b6bf0bd..fd25a3a 100644
--- a/testsuites/psxtests/psxhdrs/math/acoshl.c
+++ b/testsuites/psxtests/psxhdrs/math/acoshl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/acosl.c b/testsuites/psxtests/psxhdrs/math/acosl.c
index d2235ae..9176131 100644
--- a/testsuites/psxtests/psxhdrs/math/acosl.c
+++ b/testsuites/psxtests/psxhdrs/math/acosl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
     return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/asinhl.c b/testsuites/psxtests/psxhdrs/math/asinhl.c
index e3a2a0e..607b02d 100644
--- a/testsuites/psxtests/psxhdrs/math/asinhl.c
+++ b/testsuites/psxtests/psxhdrs/math/asinhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result); /* This should return 0 */
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/asinl.c b/testsuites/psxtests/psxhdrs/math/asinl.c
index 1ed9e85..d28833f 100644
--- a/testsuites/psxtests/psxhdrs/math/asinl.c
+++ b/testsuites/psxtests/psxhdrs/math/asinl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;  /* This should return 0 */
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/atan2l.c b/testsuites/psxtests/psxhdrs/math/atan2l.c
index 3ce992a..01c13a9 100644
--- a/testsuites/psxtests/psxhdrs/math/atan2l.c
+++ b/testsuites/psxtests/psxhdrs/math/atan2l.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
     return (result) ;  /* This should return 0 */
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/atanhl.c b/testsuites/psxtests/psxhdrs/math/atanhl.c
index bf75c1e..2631ea6 100644
--- a/testsuites/psxtests/psxhdrs/math/atanhl.c
+++ b/testsuites/psxtests/psxhdrs/math/atanhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
     return (result) ;  /* This should return 0 */
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/atanl.c b/testsuites/psxtests/psxhdrs/math/atanl.c
index 6a1cddc..b19708c 100644
--- a/testsuites/psxtests/psxhdrs/math/atanl.c
+++ b/testsuites/psxtests/psxhdrs/math/atanl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
     return (result) ;  /* This should return 0 */
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/cbrtl.c b/testsuites/psxtests/psxhdrs/math/cbrtl.c
index 177566c..7c54d66 100644
--- a/testsuites/psxtests/psxhdrs/math/cbrtl.c
+++ b/testsuites/psxtests/psxhdrs/math/cbrtl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
     return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/ceill.c b/testsuites/psxtests/psxhdrs/math/ceill.c
index 4e9fd19..c37e146 100644
--- a/testsuites/psxtests/psxhdrs/math/ceill.c
+++ b/testsuites/psxtests/psxhdrs/math/ceill.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
     return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/copysignl.c b/testsuites/psxtests/psxhdrs/math/copysignl.c
index 448d14e..db5e57e 100644
--- a/testsuites/psxtests/psxhdrs/math/copysignl.c
+++ b/testsuites/psxtests/psxhdrs/math/copysignl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
     return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/coshl.c b/testsuites/psxtests/psxhdrs/math/coshl.c
index 38b6c55..7281a37 100644
--- a/testsuites/psxtests/psxhdrs/math/coshl.c
+++ b/testsuites/psxtests/psxhdrs/math/coshl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/cosl.c b/testsuites/psxtests/psxhdrs/math/cosl.c
index fff1080..7eacbf8 100644
--- a/testsuites/psxtests/psxhdrs/math/cosl.c
+++ b/testsuites/psxtests/psxhdrs/math/cosl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/erfcl.c b/testsuites/psxtests/psxhdrs/math/erfcl.c
index bea370c..9a50718 100644
--- a/testsuites/psxtests/psxhdrs/math/erfcl.c
+++ b/testsuites/psxtests/psxhdrs/math/erfcl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/erfl.c b/testsuites/psxtests/psxhdrs/math/erfl.c
index 35bb58a..5983f6e 100644
--- a/testsuites/psxtests/psxhdrs/math/erfl.c
+++ b/testsuites/psxtests/psxhdrs/math/erfl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/exp2l.c b/testsuites/psxtests/psxhdrs/math/exp2l.c
index cc39afd..02e21ae 100644
--- a/testsuites/psxtests/psxhdrs/math/exp2l.c
+++ b/testsuites/psxtests/psxhdrs/math/exp2l.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/expl.c b/testsuites/psxtests/psxhdrs/math/expl.c
index 1ae0f8c..39e61f0 100644
--- a/testsuites/psxtests/psxhdrs/math/expl.c
+++ b/testsuites/psxtests/psxhdrs/math/expl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/expm1l.c b/testsuites/psxtests/psxhdrs/math/expm1l.c
index e677e0a..23ac312 100644
--- a/testsuites/psxtests/psxhdrs/math/expm1l.c
+++ b/testsuites/psxtests/psxhdrs/math/expm1l.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fabsl.c b/testsuites/psxtests/psxhdrs/math/fabsl.c
index d32bd7b..0b5f432 100644
--- a/testsuites/psxtests/psxhdrs/math/fabsl.c
+++ b/testsuites/psxtests/psxhdrs/math/fabsl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fdiml.c b/testsuites/psxtests/psxhdrs/math/fdiml.c
index 000c6ef..b6a7ba4 100644
--- a/testsuites/psxtests/psxhdrs/math/fdiml.c
+++ b/testsuites/psxtests/psxhdrs/math/fdiml.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/floorl.c b/testsuites/psxtests/psxhdrs/math/floorl.c
index 8a34358..c19db68 100644
--- a/testsuites/psxtests/psxhdrs/math/floorl.c
+++ b/testsuites/psxtests/psxhdrs/math/floorl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fmal.c b/testsuites/psxtests/psxhdrs/math/fmal.c
index baf80a7..13459a7 100644
--- a/testsuites/psxtests/psxhdrs/math/fmal.c
+++ b/testsuites/psxtests/psxhdrs/math/fmal.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -49,3 +51,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fmaxl.c b/testsuites/psxtests/psxhdrs/math/fmaxl.c
index 68bb6a0..ed711c9 100644
--- a/testsuites/psxtests/psxhdrs/math/fmaxl.c
+++ b/testsuites/psxtests/psxhdrs/math/fmaxl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fminl.c b/testsuites/psxtests/psxhdrs/math/fminl.c
index b8c5dfb..9a86ee7 100644
--- a/testsuites/psxtests/psxhdrs/math/fminl.c
+++ b/testsuites/psxtests/psxhdrs/math/fminl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/fmodl.c b/testsuites/psxtests/psxhdrs/math/fmodl.c
index 7111ff6..2f562ef 100644
--- a/testsuites/psxtests/psxhdrs/math/fmodl.c
+++ b/testsuites/psxtests/psxhdrs/math/fmodl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/frexpl.c b/testsuites/psxtests/psxhdrs/math/frexpl.c
index 3ad3e25..ad827d7 100644
--- a/testsuites/psxtests/psxhdrs/math/frexpl.c
+++ b/testsuites/psxtests/psxhdrs/math/frexpl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/has_long_double.h b/testsuites/psxtests/psxhdrs/math/has_long_double.h
new file mode 100644
index 0000000..aeef1e4
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/math/has_long_double.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief Defines NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
+ *
+ * This file uses logic copied from newlib's math.h on 21 Jan 2021
+ * to determine whether or not the long double math functions tests
+ * should be built. The original math.h file was sourced from
+ * https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/a0d7982
+ * The original math.h this is based on has no license or copyright notice
+ */
+
+/*
+ * Copyright (C) 2021 OAR Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HAS_LONG_DOUBLE_H
+#define HAS_LONG_DOUBLE_H
+
+/* Newlib doesn't fully support long double math functions so far.
+   On platforms where long double equals double the long double functions
+   simply call the double functions.  On Cygwin the long double functions
+   are implemented independently from newlib to be able to use optimized
+   assembler functions despite using the Microsoft x86_64 ABI. */
+#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
+#ifndef __math_68881
+#define NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS 1
+#endif
+#endif
+
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/hypotl.c b/testsuites/psxtests/psxhdrs/math/hypotl.c
index bffc632..182e402 100644
--- a/testsuites/psxtests/psxhdrs/math/hypotl.c
+++ b/testsuites/psxtests/psxhdrs/math/hypotl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/ilogbl.c b/testsuites/psxtests/psxhdrs/math/ilogbl.c
index 8daa32d..9c8486c 100644
--- a/testsuites/psxtests/psxhdrs/math/ilogbl.c
+++ b/testsuites/psxtests/psxhdrs/math/ilogbl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/ldexpl.c b/testsuites/psxtests/psxhdrs/math/ldexpl.c
index de1a2dc..369f951 100644
--- a/testsuites/psxtests/psxhdrs/math/ldexpl.c
+++ b/testsuites/psxtests/psxhdrs/math/ldexpl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/lgammal.c b/testsuites/psxtests/psxhdrs/math/lgammal.c
index 156b390..c126812 100644
--- a/testsuites/psxtests/psxhdrs/math/lgammal.c
+++ b/testsuites/psxtests/psxhdrs/math/lgammal.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/llrintl.c b/testsuites/psxtests/psxhdrs/math/llrintl.c
index f8e73ac..500a7ef 100644
--- a/testsuites/psxtests/psxhdrs/math/llrintl.c
+++ b/testsuites/psxtests/psxhdrs/math/llrintl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/llroundl.c b/testsuites/psxtests/psxhdrs/math/llroundl.c
index ed085e4..672ef06 100644
--- a/testsuites/psxtests/psxhdrs/math/llroundl.c
+++ b/testsuites/psxtests/psxhdrs/math/llroundl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/log10l.c b/testsuites/psxtests/psxhdrs/math/log10l.c
index 0339489..5918a7a 100644
--- a/testsuites/psxtests/psxhdrs/math/log10l.c
+++ b/testsuites/psxtests/psxhdrs/math/log10l.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/log1pl.c b/testsuites/psxtests/psxhdrs/math/log1pl.c
index 98015c0..1f92653 100644
--- a/testsuites/psxtests/psxhdrs/math/log1pl.c
+++ b/testsuites/psxtests/psxhdrs/math/log1pl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/log2l.c b/testsuites/psxtests/psxhdrs/math/log2l.c
index 7d29cc5..30e1c0a 100644
--- a/testsuites/psxtests/psxhdrs/math/log2l.c
+++ b/testsuites/psxtests/psxhdrs/math/log2l.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/logbl.c b/testsuites/psxtests/psxhdrs/math/logbl.c
index d50f50f..ffddfd6 100644
--- a/testsuites/psxtests/psxhdrs/math/logbl.c
+++ b/testsuites/psxtests/psxhdrs/math/logbl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/logl.c b/testsuites/psxtests/psxhdrs/math/logl.c
index 11b4616..3506148 100644
--- a/testsuites/psxtests/psxhdrs/math/logl.c
+++ b/testsuites/psxtests/psxhdrs/math/logl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/lrintl.c b/testsuites/psxtests/psxhdrs/math/lrintl.c
index 2430b18..5e535b9 100644
--- a/testsuites/psxtests/psxhdrs/math/lrintl.c
+++ b/testsuites/psxtests/psxhdrs/math/lrintl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/lroundl.c b/testsuites/psxtests/psxhdrs/math/lroundl.c
index a79bdeb..823ae2f 100644
--- a/testsuites/psxtests/psxhdrs/math/lroundl.c
+++ b/testsuites/psxtests/psxhdrs/math/lroundl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/modfl.c b/testsuites/psxtests/psxhdrs/math/modfl.c
index ed0c5fd..e55b911 100644
--- a/testsuites/psxtests/psxhdrs/math/modfl.c
+++ b/testsuites/psxtests/psxhdrs/math/modfl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nanl.c b/testsuites/psxtests/psxhdrs/math/nanl.c
index 7192858..631fb32 100644
--- a/testsuites/psxtests/psxhdrs/math/nanl.c
+++ b/testsuites/psxtests/psxhdrs/math/nanl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nearbyintl.c b/testsuites/psxtests/psxhdrs/math/nearbyintl.c
index 38a681b..bea7d94 100644
--- a/testsuites/psxtests/psxhdrs/math/nearbyintl.c
+++ b/testsuites/psxtests/psxhdrs/math/nearbyintl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nextafterl.c b/testsuites/psxtests/psxhdrs/math/nextafterl.c
index 2b0fb54..4280569 100644
--- a/testsuites/psxtests/psxhdrs/math/nextafterl.c
+++ b/testsuites/psxtests/psxhdrs/math/nextafterl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nexttoward.c b/testsuites/psxtests/psxhdrs/math/nexttoward.c
index e84ac5c..f73d1fa 100644
--- a/testsuites/psxtests/psxhdrs/math/nexttoward.c
+++ b/testsuites/psxtests/psxhdrs/math/nexttoward.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nexttowardf.c b/testsuites/psxtests/psxhdrs/math/nexttowardf.c
index ceb2a99..e65e68d 100644
--- a/testsuites/psxtests/psxhdrs/math/nexttowardf.c
+++ b/testsuites/psxtests/psxhdrs/math/nexttowardf.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/nexttowardl.c b/testsuites/psxtests/psxhdrs/math/nexttowardl.c
index c94ea4d..d895e3f 100644
--- a/testsuites/psxtests/psxhdrs/math/nexttowardl.c
+++ b/testsuites/psxtests/psxhdrs/math/nexttowardl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/powl.c b/testsuites/psxtests/psxhdrs/math/powl.c
index da68a82..e39d211 100644
--- a/testsuites/psxtests/psxhdrs/math/powl.c
+++ b/testsuites/psxtests/psxhdrs/math/powl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/remainderl.c b/testsuites/psxtests/psxhdrs/math/remainderl.c
index 4323669..6d505a8 100644
--- a/testsuites/psxtests/psxhdrs/math/remainderl.c
+++ b/testsuites/psxtests/psxhdrs/math/remainderl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/remquol.c b/testsuites/psxtests/psxhdrs/math/remquol.c
index 4c56301..e3b796e 100644
--- a/testsuites/psxtests/psxhdrs/math/remquol.c
+++ b/testsuites/psxtests/psxhdrs/math/remquol.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/rintl.c b/testsuites/psxtests/psxhdrs/math/rintl.c
index 3f6a850..4fbd5cf 100644
--- a/testsuites/psxtests/psxhdrs/math/rintl.c
+++ b/testsuites/psxtests/psxhdrs/math/rintl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/roundl.c b/testsuites/psxtests/psxhdrs/math/roundl.c
index 421b18b..a86a44e 100644
--- a/testsuites/psxtests/psxhdrs/math/roundl.c
+++ b/testsuites/psxtests/psxhdrs/math/roundl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/scalblnl.c b/testsuites/psxtests/psxhdrs/math/scalblnl.c
index fb80603..e3fd17d 100644
--- a/testsuites/psxtests/psxhdrs/math/scalblnl.c
+++ b/testsuites/psxtests/psxhdrs/math/scalblnl.c
@@ -35,8 +35,10 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 #include <float.h>
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/scalbnl.c b/testsuites/psxtests/psxhdrs/math/scalbnl.c
index 578c249..65f28ba 100644
--- a/testsuites/psxtests/psxhdrs/math/scalbnl.c
+++ b/testsuites/psxtests/psxhdrs/math/scalbnl.c
@@ -35,8 +35,10 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 #include <float.h>
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -48,3 +50,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/sinhl.c b/testsuites/psxtests/psxhdrs/math/sinhl.c
index 645a789..a55104c 100644
--- a/testsuites/psxtests/psxhdrs/math/sinhl.c
+++ b/testsuites/psxtests/psxhdrs/math/sinhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/sinl.c b/testsuites/psxtests/psxhdrs/math/sinl.c
index ae75af5..228027e 100644
--- a/testsuites/psxtests/psxhdrs/math/sinl.c
+++ b/testsuites/psxtests/psxhdrs/math/sinl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/sqrtl.c b/testsuites/psxtests/psxhdrs/math/sqrtl.c
index 0fc940e..c491b74 100644
--- a/testsuites/psxtests/psxhdrs/math/sqrtl.c
+++ b/testsuites/psxtests/psxhdrs/math/sqrtl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/tanhl.c b/testsuites/psxtests/psxhdrs/math/tanhl.c
index 7a123f9..5cb219c 100644
--- a/testsuites/psxtests/psxhdrs/math/tanhl.c
+++ b/testsuites/psxtests/psxhdrs/math/tanhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/tanl.c b/testsuites/psxtests/psxhdrs/math/tanl.c
index 3f8aba5..b6c20a3 100644
--- a/testsuites/psxtests/psxhdrs/math/tanl.c
+++ b/testsuites/psxtests/psxhdrs/math/tanl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result) ;
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/tgammal.c b/testsuites/psxtests/psxhdrs/math/tgammal.c
index a5e8d7c..6a9518a 100644
--- a/testsuites/psxtests/psxhdrs/math/tgammal.c
+++ b/testsuites/psxtests/psxhdrs/math/tgammal.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/truncl.c b/testsuites/psxtests/psxhdrs/math/truncl.c
index 0590ffa..6a657dd 100644
--- a/testsuites/psxtests/psxhdrs/math/truncl.c
+++ b/testsuites/psxtests/psxhdrs/math/truncl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include <math.h>
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif



More information about the vc mailing list