summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxhdrs/math/has_long_double.h
diff options
context:
space:
mode:
authorStephen Clark <stephen.clark@oarcorp.com>2021-03-17 17:48:57 -0500
committerJoel Sherrill <joel@rtems.org>2021-05-05 09:45:56 -0500
commite5590a3ea1da6bc3e57651b51b8c356d881a60bd (patch)
tree90ee892c2babeed34efb2aae30c4ae686a2a99a2 /testsuites/psxtests/psxhdrs/math/has_long_double.h
parentstackchk: Fixed 32bit pointers (diff)
downloadrtems-e5590a3ea1da6bc3e57651b51b8c356d881a60bd.tar.bz2
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.
Diffstat (limited to 'testsuites/psxtests/psxhdrs/math/has_long_double.h')
-rw-r--r--testsuites/psxtests/psxhdrs/math/has_long_double.h54
1 files changed, 54 insertions, 0 deletions
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 0000000000..aeef1e466a
--- /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