From a96c9fd437dbd009cdf4b830040c17bf67e7700c Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Tue, 20 Sep 2016 16:57:08 +0900 Subject: [PATCH] Bug 1303463 - Use safer STRICT_ASSIGN on VisualStudio. r=jwalden --- ...safer_strict_assign_on_visual_studio.patch | 23 +++++++++++++++++++ modules/fdlibm/src/math_private.h | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch diff --git a/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch b/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch new file mode 100644 index 000000000000..282edbb7818c --- /dev/null +++ b/modules/fdlibm/patches/15_use_safer_strict_assign_on_visual_studio.patch @@ -0,0 +1,23 @@ +diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h +--- a/modules/fdlibm/src/math_private.h ++++ b/modules/fdlibm/src/math_private.h +@@ -271,17 +271,17 @@ do { \ + /* The above works on non-i386 too, but we use this to check v. */ + #define LD80C(m, ex, v) { .e = (v), } + #endif + + #ifdef FLT_EVAL_METHOD + /* + * Attempt to get strict C99 semantics for assignment with non-C99 compilers. + */ +-#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 ++#if !defined(_MSC_VER) && (FLT_EVAL_METHOD == 0 || __GNUC__ == 0) + #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) + #else + #define STRICT_ASSIGN(type, lval, rval) do { \ + volatile type __lval; \ + \ + if (sizeof(type) >= sizeof(long double)) \ + (lval) = (rval); \ + else { \ + diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h index 511cbf8eae49..b9e59446dafb 100644 --- a/modules/fdlibm/src/math_private.h +++ b/modules/fdlibm/src/math_private.h @@ -276,7 +276,7 @@ do { \ /* * Attempt to get strict C99 semantics for assignment with non-C99 compilers. */ -#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 +#if !defined(_MSC_VER) && (FLT_EVAL_METHOD == 0 || __GNUC__ == 0) #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) #else #define STRICT_ASSIGN(type, lval, rval) do { \