public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove __nan{f,,l} macros
@ 2016-09-13 21:07 Paul E. Murphy
  2016-09-13 22:58 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. Murphy @ 2016-09-13 21:07 UTC (permalink / raw)
  To: libc-alpha

Use the GCC builtin instead.  With the exception of the
files built from a template, they are unused.  This
is preparation for making the s_nanF objects generated.

	* math/s_nanf.c: Remove __nanf undef.
	* math/s_nan.c: Remove __nan undef.
	* math/s_nanl.c: Remove __nanl undef.

	* sysdeps/generic/math_private.h (__nan): Remove macro
	override.
	(__nanf): Likewise.
	(__nanl): Likewise.

	* sysdeps/generic/math-type-macros.h (M_NAN): define
	using GCC builtin instead.
---
 math/s_nan.c                       | 1 -
 math/s_nanf.c                      | 1 -
 math/s_nanl.c                      | 1 -
 sysdeps/generic/math-type-macros.h | 2 +-
 sysdeps/generic/math_private.h     | 7 -------
 5 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/math/s_nan.c b/math/s_nan.c
index d9af775..03e95f5 100644
--- a/math/s_nan.c
+++ b/math/s_nan.c
@@ -24,7 +24,6 @@
 #include <ieee754.h>
 
 
-#undef __nan
 double
 __nan (const char *tagp)
 {
diff --git a/math/s_nanf.c b/math/s_nanf.c
index 0dd6778..3046720 100644
--- a/math/s_nanf.c
+++ b/math/s_nanf.c
@@ -24,7 +24,6 @@
 #include <ieee754.h>
 
 
-#undef __nanf
 float
 __nanf (const char *tagp)
 {
diff --git a/math/s_nanl.c b/math/s_nanl.c
index e6149bc..4b7b3d5 100644
--- a/math/s_nanl.c
+++ b/math/s_nanl.c
@@ -24,7 +24,6 @@
 #include <ieee754.h>
 
 
-#undef __nanl
 long double
 __nanl (const char *tagp)
 {
diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h
index bd9e25a..78b883c 100644
--- a/sysdeps/generic/math-type-macros.h
+++ b/sysdeps/generic/math-type-macros.h
@@ -74,7 +74,7 @@
 #define __M_CONCAT(a,b) a ## b
 #define __M_CONCATX(a,b) __M_CONCAT(a,b)
 
-#define M_NAN M_SUF (__nan) ("")
+#define M_NAN M_SUF (__builtin_nan) ("")
 #define M_MAX_EXP __M_CONCATX (M_PFX, _MAX_EXP)
 #define M_MIN __M_CONCATX (M_PFX, _MIN)
 #define M_MAX __M_CONCATX (M_PFX, _MAX)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 24adcfb..28e5df0 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -775,11 +775,4 @@ libc_feresetround_noex_ctx (struct rm_ctx *ctx)
   SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_53bit,	      \
 			     libc_feresetround_53bit)
 
-#define __nan(str) \
-  (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
-#define __nanf(str) \
-  (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
-#define __nanl(str) \
-  (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
-
 #endif /* _MATH_PRIVATE_H_ */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Remove __nan{f,,l} macros
  2016-09-13 21:07 [PATCH] Remove __nan{f,,l} macros Paul E. Murphy
@ 2016-09-13 22:58 ` Joseph Myers
  2016-09-20 19:45   ` Paul E. Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2016-09-13 22:58 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: libc-alpha

On Tue, 13 Sep 2016, Paul E. Murphy wrote:

> Use the GCC builtin instead.  With the exception of the
> files built from a template, they are unused.  This
> is preparation for making the s_nanF objects generated.
> 
> 	* math/s_nanf.c: Remove __nanf undef.
> 	* math/s_nan.c: Remove __nan undef.
> 	* math/s_nanl.c: Remove __nanl undef.
> 
> 	* sysdeps/generic/math_private.h (__nan): Remove macro
> 	override.
> 	(__nanf): Likewise.
> 	(__nanl): Likewise.
> 
> 	* sysdeps/generic/math-type-macros.h (M_NAN): define
> 	using GCC builtin instead.

OK.  To be clear, this may change code generation, and those changes are 
appropriate (they have the effect of using a default NaN for the relevant 
type rather than the result of converting a default NaN for double to that 
type, which may be different on those platforms where a default NaN has 
all-1s mantissa).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Remove __nan{f,,l} macros
  2016-09-13 22:58 ` Joseph Myers
@ 2016-09-20 19:45   ` Paul E. Murphy
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. Murphy @ 2016-09-20 19:45 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

Committed as fc7f469.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-20 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 21:07 [PATCH] Remove __nan{f,,l} macros Paul E. Murphy
2016-09-13 22:58 ` Joseph Myers
2016-09-20 19:45   ` Paul E. Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).