From 38a1aa117f3d1974ab6653b692e9946e3d11db4a Mon Sep 17 00:00:00 2001 From: Matthew G McGovern Date: Mon, 12 Aug 2019 18:08:44 +0000 Subject: [PATCH] [builtins] MSVC warning disable for clean build - https://reviews.llvm.org/D66023 - amended for ifdef/if gcc errors in previous verison llvm-svn: 368598 --- compiler-rt/lib/builtins/emutls.c | 11 +++++++++++ compiler-rt/lib/builtins/fixunsxfdi.c | 11 +++++++++++ compiler-rt/lib/builtins/fixunsxfsi.c | 11 +++++++++++ compiler-rt/lib/builtins/fixxfdi.c | 11 +++++++++++ compiler-rt/lib/builtins/udivmoddi4.c | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/compiler-rt/lib/builtins/emutls.c b/compiler-rt/lib/builtins/emutls.c index da58feb..e0aa191 100644 --- a/compiler-rt/lib/builtins/emutls.c +++ b/compiler-rt/lib/builtins/emutls.c @@ -26,12 +26,23 @@ #define EMUTLS_SKIP_DESTRUCTOR_ROUNDS 0 #endif +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC raises a warning about a nonstandard extension being used for the 0 +// sized element in this array. Disable this for warn-as-error builds. +#pragma warning(push) +#pragma warning(disable : 4206) +#endif + typedef struct emutls_address_array { uintptr_t skip_destructor_rounds; uintptr_t size; // number of elements in the 'data' array void *data[]; } emutls_address_array; +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif + static void emutls_shutdown(emutls_address_array *array); #ifndef _WIN32 diff --git a/compiler-rt/lib/builtins/fixunsxfdi.c b/compiler-rt/lib/builtins/fixunsxfdi.c index 75c4f09..852a664 100644 --- a/compiler-rt/lib/builtins/fixunsxfdi.c +++ b/compiler-rt/lib/builtins/fixunsxfdi.c @@ -25,6 +25,13 @@ // eeee | 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm // mmmm mmmm mmmm +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC throws a warning about 'unitialized variable use' here, +// disable it for builds that warn-as-error +#pragma warning(push) +#pragma warning(disable : 4700) +#endif + COMPILER_RT_ABI du_int __fixunsxfdi(long double a) { long_double_bits fb; fb.f = a; @@ -36,4 +43,8 @@ COMPILER_RT_ABI du_int __fixunsxfdi(long double a) { return fb.u.low.all >> (63 - e); } +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) #endif + +#endif //!_ARCH_PPC \ No newline at end of file diff --git a/compiler-rt/lib/builtins/fixunsxfsi.c b/compiler-rt/lib/builtins/fixunsxfsi.c index 1432d8b..3bc1288 100644 --- a/compiler-rt/lib/builtins/fixunsxfsi.c +++ b/compiler-rt/lib/builtins/fixunsxfsi.c @@ -25,6 +25,13 @@ // eeee | 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm // mmmm mmmm mmmm +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC throws a warning about 'unitialized variable use' here, +// disable it for builds that warn-as-error +#pragma warning(push) +#pragma warning(disable : 4700) +#endif + COMPILER_RT_ABI su_int __fixunsxfsi(long double a) { long_double_bits fb; fb.f = a; @@ -36,4 +43,8 @@ COMPILER_RT_ABI su_int __fixunsxfsi(long double a) { return fb.u.low.s.high >> (31 - e); } +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif + #endif // !_ARCH_PPC diff --git a/compiler-rt/lib/builtins/fixxfdi.c b/compiler-rt/lib/builtins/fixxfdi.c index 4783c01..a7a0464 100644 --- a/compiler-rt/lib/builtins/fixxfdi.c +++ b/compiler-rt/lib/builtins/fixxfdi.c @@ -24,6 +24,13 @@ // eeee | 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm // mmmm mmmm mmmm +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC throws a warning about 'unitialized variable use' here, +// disable it for builds that warn-as-error +#pragma warning(push) +#pragma warning(disable : 4700) +#endif + COMPILER_RT_ABI di_int __fixxfdi(long double a) { const di_int di_max = (di_int)((~(du_int)0) / 2); const di_int di_min = -di_max - 1; @@ -40,4 +47,8 @@ COMPILER_RT_ABI di_int __fixxfdi(long double a) { return (r ^ s) - s; } +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif + #endif // !_ARCH_PPC diff --git a/compiler-rt/lib/builtins/udivmoddi4.c b/compiler-rt/lib/builtins/udivmoddi4.c index 2914cc0..4db9be9 100644 --- a/compiler-rt/lib/builtins/udivmoddi4.c +++ b/compiler-rt/lib/builtins/udivmoddi4.c @@ -17,6 +17,13 @@ // Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide +#if defined(_MSC_VER) && !defined(__clang__) +// MSVC throws a warning about mod 0 here, disable it for builds that +// warn-as-error +#pragma warning(push) +#pragma warning(disable : 4724) +#endif + COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int *rem) { const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT; const unsigned n_udword_bits = sizeof(du_int) * CHAR_BIT; @@ -187,3 +194,7 @@ COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int *rem) { *rem = r.all; return q.all; } + +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif \ No newline at end of file -- 2.7.4