Bug 1567944 - remove *DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING macros; r=dmajor
authorNathan Froyd <froydnj@mozilla.com>
Tue, 23 Jul 2019 08:02:48 +0000
changeset 483847 04b82bfc269eb6c01b0ab4024402e48b8de17b76
parent 483846 cd3decf2c1d475b393a2269a1b56ed71ca54378d
child 483848 4c2ba62a4f850983f7fbf49c010693e21a8e8d71
push id90643
push usernfroyd@mozilla.com
push dateTue, 23 Jul 2019 14:21:09 +0000
treeherderautoland@04b82bfc269e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1567944
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1567944 - remove *DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING macros; r=dmajor We don't support MSVC anymore, clang-cl ignores these pragmas, and nobody actually used the macros anyway. Depends on D38887 Differential Revision: https://phabricator.services.mozilla.com/D38888
mfbt/HashFunctions.h
mfbt/WrappingOperations.h
--- a/mfbt/HashFunctions.h
+++ b/mfbt/HashFunctions.h
@@ -280,19 +280,16 @@ MOZ_MUST_USE inline HashNumber HashStrin
                                aLength);
 }
 
 MOZ_MUST_USE
 inline HashNumber HashString(const unsigned char* aStr, size_t aLength) {
   return HashStringKnownLength(aStr, aLength);
 }
 
-// You may need to use the
-// MOZ_{PUSH,POP}_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING macros if you use
-// this function. See the comment on those macros' definitions for more detail.
 MOZ_MUST_USE constexpr HashNumber HashString(const char16_t* aStr) {
   return HashStringUntilZero(aStr);
 }
 
 MOZ_MUST_USE inline HashNumber HashString(const char16_t* aStr,
                                           size_t aLength) {
   return HashStringKnownLength(aStr, aLength);
 }
--- a/mfbt/WrappingOperations.h
+++ b/mfbt/WrappingOperations.h
@@ -252,35 +252,11 @@ struct WrappingMultiplyHelper {
  * multiplication *tends* to behave with most compilers, unless an optimization
  * or similar -- quite permissibly -- triggers different behavior.
  */
 template <typename T>
 constexpr T WrappingMultiply(T aX, T aY) {
   return detail::WrappingMultiplyHelper<T>::compute(aX, aY);
 }
 
-// The |mozilla::Wrapping*| functions are constexpr. Unfortunately, MSVC warns
-// about well-defined unsigned integer overflows that may occur within the
-// constexpr math.
-//
-//   https://msdn.microsoft.com/en-us/library/4kze989h.aspx (C4307)
-//   https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html
-//   (bug report)
-//
-// So we need a way to suppress these warnings. Unfortunately, the warnings are
-// issued at the very top of the `constexpr` chain, which is often some
-// distance from the triggering Wrapping*() operation. So we can't suppress
-// them within this file. Instead, callers have to do it with these macros.
-//
-// If/when MSVC fix this bug, we should remove these macros.
-#ifdef _MSC_VER
-#  define MOZ_PUSH_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING \
-    __pragma(warning(push)) __pragma(warning(disable : 4307))
-#  define MOZ_POP_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING \
-    __pragma(warning(pop))
-#else
-#  define MOZ_PUSH_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-#  define MOZ_POP_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
-#endif
-
 } /* namespace mozilla */
 
 #endif /* mozilla_WrappingOperations_h */