about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-17 16:00:39 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-17 16:00:39 -0400
commitc8553a6a6f6fdb20950e5e6b62bfa7e21350449c (patch)
tree4ce05018729f45cf7e268e1f1ef2608ce0e32d28
parented22dcf691326d148222eb9a215d6d98bb8073a4 (diff)
downloadglibc-c8553a6a6f6fdb20950e5e6b62bfa7e21350449c.tar.gz
glibc-c8553a6a6f6fdb20950e5e6b62bfa7e21350449c.tar.xz
glibc-c8553a6a6f6fdb20950e5e6b62bfa7e21350449c.zip
Makr x86-64 math_private.h more robust
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/x86_64/fpu/math_private.h20
2 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index af72e63d8d..e66482f3bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-10-17  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/x86_64/fpu/math_private.h: Add some parenthesis to be safe
+	about macro parameter expansion.
+
 	* sysdeps/x86_64/fpu/bits/mathinline.h: Don't define inlines if
 	__NO_MATH_INLINES is defined.  Cleanups.
 
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 71eb41664f..a66616b7a5 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -58,21 +58,21 @@ do {								\
 #endif
 
 #define __isnan(d) \
-  ({ long int __di; EXTRACT_WORDS64 (__di, (double) d);			      \
+  ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d));		      \
      (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; })
 #define __isnanf(d) \
   ({ int __di; GET_FLOAT_WORD (__di, (float) d);			      \
      (__di & 0x7fffffff) > 0x7f800000; })
 
 #define __isinf_ns(d) \
-  ({ long int __di; EXTRACT_WORDS64 (__di, (double) d);			      \
+  ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d));		      \
      (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; })
 #define __isinf_nsf(d) \
   ({ int __di; GET_FLOAT_WORD (__di, (float) d);			      \
      (__di & 0x7fffffff) == 0x7f800000; })
 
 #define __finite(d) \
-  ({ long int __di; EXTRACT_WORDS64 (__di, (double) d);			      \
+  ({ long int __di; EXTRACT_WORDS64 (__di, (double) (d));		      \
      (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; })
 #define __finitef(d) \
   ({ int __di; GET_FLOAT_WORD (__di, (float) d);			      \
@@ -80,41 +80,41 @@ do {								\
 
 #define __ieee754_sqrt(d) \
   ({ double __res;							      \
-     asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) d));		      \
+    asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) (d)));		      \
      __res; })
 #define __ieee754_sqrtf(d) \
   ({ float __res;							      \
-     asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) d));		      \
+    asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) (d)));		      \
      __res; })
 #define __ieee754_sqrtl(d) \
   ({ long double __res;							      \
-     asm ("fsqrt" : "=t" (__res) : "0" ((long double) d));		      \
+    asm ("fsqrt" : "=t" (__res) : "0" ((long double) (d)));		      \
      __res; })
 
 #ifdef __SSE4_1__
 # ifndef __rint
 #  define __rint(d) \
   ({ double __res; \
-     asm ("roundsd $4, %1, %0" : "=x" (__res) : "x" ((double) d));	      \
+    asm ("roundsd $4, %1, %0" : "=x" (__res) : "x" ((double) (d)));	      \
      __res; })
 # endif
 # ifndef __rintf
 #  define __rintf(d) \
   ({ float __res; \
-     asm ("roundss $4, %1, %0" : "=x" (__res) : "x" ((float) d));	      \
+    asm ("roundss $4, %1, %0" : "=x" (__res) : "x" ((float) (d)));	      \
      __res; })
 # endif
 
 # ifndef __floor
 #  define __floor(d) \
   ({ double __res; \
-     asm ("roundsd $1, %1, %0" : "=x" (__res) : "x" ((double) d));	      \
+    asm ("roundsd $1, %1, %0" : "=x" (__res) : "x" ((double) (d)));	      \
      __res; })
 # endif
 # ifndef __floorf
 #  define __floorf(d) \
   ({ float __res; \
-     asm ("roundss $1, %1, %0" : "=x" (__res) : "x" ((float) d));	      \
+    asm ("roundss $1, %1, %0" : "=x" (__res) : "x" ((float) (d)));	      \
      __res; })
 # endif
 #endif