Fix MSVC release build after r490852
Disable integer overflow warnings in integer overflow tests.
[email protected]
Bug: 751198
Change-Id: Ia5680199a51f0ecb951744838e624f9d6f1d7573
Reviewed-on: https://chromium-review.googlesource.com/596511
Reviewed-by: Justin Schuh <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Commit-Queue: Justin Schuh <[email protected]>
Cr-Commit-Position: refs/heads/master@{#491085}
diff --git a/base/safe_numerics_unittest.cc b/base/safe_numerics_unittest.cc
index 5489f81..82aea50 100644
--- a/base/safe_numerics_unittest.cc
+++ b/base/safe_numerics_unittest.cc
@@ -9,6 +9,15 @@
#include <type_traits>
#include "base/compiler_specific.h"
+
+// WARNING: This block must come before the base/numerics headers are included.
+// These tests deliberately cause arithmetic boundary errors. If the compiler is
+// aggressive enough, it can const detect these errors, so we disable warnings.
+#if defined(OS_WIN)
+#pragma warning(disable : 4756) // Arithmetic overflow.
+#pragma warning(disable : 4293) // Invalid shift.
+#endif
+
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
@@ -25,13 +34,6 @@
using std::numeric_limits;
-// These tests deliberately cause arithmetic boundary errors. If the compiler is
-// aggressive enough, it can const detect these errors, so we disable warnings.
-#if defined(OS_WIN)
-#pragma warning(disable : 4756) // Arithmetic overflow.
-#pragma warning(disable : 4293) // Invalid shift.
-#endif
-
// This is a helper function for finding the maximum value in Src that can be
// wholy represented as the destination floating-point type.
template <typename Dst, typename Src>