[1/2] libm/common: Set WANT_ERRNO based on _IEEE_LIBM value

Message ID 20200803175504.844738-2-keithp@keithp.com
State Accepted
Commit bb166cfc3e45ceb712fb867c116b7cae4834209d
Headers show
Series
  • libm: Changes to errno and math_errhandling
Related show

Commit Message

Torbjorn SVENSSON via Newlib Aug. 3, 2020, 5:55 p.m.
_IEEE_LIBM is the configuration value which controls whether the
original libm functions modify errno. Use that in the new math code as
well so that the resulting library is internally consistent.

Signed-off-by: Keith Packard <keithp@keithp.com>

---
 newlib/libm/common/math_config.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.28.0

Patch

diff --git a/newlib/libm/common/math_config.h b/newlib/libm/common/math_config.h
index 1a2d0f639..3be7e6320 100644
--- a/newlib/libm/common/math_config.h
+++ b/newlib/libm/common/math_config.h
@@ -36,7 +36,9 @@ 
 /* Correct special case results in non-nearest rounding modes.  */
 # define WANT_ROUNDING 1
 #endif
-#ifndef WANT_ERRNO
+#ifdef _IEEE_LIBM
+# define WANT_ERRNO 0
+#else
 /* Set errno according to ISO C with (math_errhandling & MATH_ERRNO) != 0.  */
 # define WANT_ERRNO 1
 #endif