Rename a method from 'check' to 'checkBounds' to avoid colliding with a 'check' macro in an OS X system header. (No, really.) Noticed while tryservering patches for bug 798179, r=rage
authorJeff Walden <jwalden@mit.edu>
Mon, 10 Jun 2013 15:31:37 -0700
changeset 146153 b9c7d27d4b43dc57832837dff3c26896d359af76
parent 146152 094d54c0c9ea9db818d88beca4db95851bb1ecfa
child 146154 98586d2cb4524b652f70c6b5e512918ba7f6fcc8
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrage
bugs798179
milestone24.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
Rename a method from 'check' to 'checkBounds' to avoid colliding with a 'check' macro in an OS X system header. (No, really.) Noticed while tryservering patches for bug 798179, r=rage
mfbt/Casting.h
--- a/mfbt/Casting.h
+++ b/mfbt/Casting.h
@@ -59,46 +59,46 @@ enum UUComparison { FromIsBigger, FromIs
 template<typename From, typename To,
          UUComparison = (sizeof(From) > sizeof(To)) ? FromIsBigger : FromIsNotBigger>
 struct UnsignedUnsignedCheck;
 
 template<typename From, typename To>
 struct UnsignedUnsignedCheck<From, To, FromIsBigger>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       return from <= From(To(-1));
     }
 };
 
 template<typename From, typename To>
 struct UnsignedUnsignedCheck<From, To, FromIsNotBigger>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       return true;
     }
 };
 
 template<typename From, typename To>
 struct BoundsCheckImpl<From, To, FromIsUnsigned, ToIsUnsigned>
 {
   public:
-    static bool check(const From from) {
-      return UnsignedUnsignedCheck<From, To>::check(from);
+    static bool checkBounds(const From from) {
+      return UnsignedUnsignedCheck<From, To>::checkBounds(from);
     }
 };
 
 // Signed-to-unsigned range check
 
 template<typename From, typename To>
 struct BoundsCheckImpl<From, To, FromIsSigned, ToIsUnsigned>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       if (from < 0)
         return false;
       if (sizeof(To) >= sizeof(From))
         return true;
       return from <= From(To(-1));
     }
 };
 
@@ -109,47 +109,47 @@ enum USComparison { FromIsSmaller, FromI
 template<typename From, typename To,
          USComparison = (sizeof(From) < sizeof(To)) ? FromIsSmaller : FromIsNotSmaller>
 struct UnsignedSignedCheck;
 
 template<typename From, typename To>
 struct UnsignedSignedCheck<From, To, FromIsSmaller>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       return true;
     }
 };
 
 template<typename From, typename To>
 struct UnsignedSignedCheck<From, To, FromIsNotSmaller>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       const To MaxValue = To((1ULL << (CHAR_BIT * sizeof(To) - 1)) - 1);
       return from <= From(MaxValue);
     }
 };
 
 template<typename From, typename To>
 struct BoundsCheckImpl<From, To, FromIsUnsigned, ToIsSigned>
 {
   public:
-    static bool check(const From from) {
-      return UnsignedSignedCheck<From, To>::check(from);
+    static bool checkBounds(const From from) {
+      return UnsignedSignedCheck<From, To>::checkBounds(from);
     }
 };
 
 // Signed-to-signed range check
 
 template<typename From, typename To>
 struct BoundsCheckImpl<From, To, FromIsSigned, ToIsSigned>
 {
   public:
-    static bool check(const From from) {
+    static bool checkBounds(const From from) {
       if (sizeof(From) <= sizeof(To))
         return true;
       const To MaxValue = To((1ULL << (CHAR_BIT * sizeof(To) - 1)) - 1);
       const To MinValue = -MaxValue - To(1);
       return From(MinValue) <= from &&
              From(from) <= From(MaxValue);
     }
 };
@@ -157,33 +157,33 @@ struct BoundsCheckImpl<From, To, FromIsS
 template<typename From, typename To,
          bool TypesAreIntegral = IsIntegral<From>::value && IsIntegral<To>::value>
 class BoundsChecker;
 
 template<typename From>
 class BoundsChecker<From, From, true>
 {
   public:
-    static bool check(const From from) { return true; }
+    static bool checkBounds(const From from) { return true; }
 };
 
 template<typename From, typename To>
 class BoundsChecker<From, To, true>
 {
   public:
-    static bool check(const From from) {
-      return BoundsCheckImpl<From, To>::check(from);
+    static bool checkBounds(const From from) {
+      return BoundsCheckImpl<From, To>::checkBounds(from);
     }
 };
 
 template<typename From, typename To>
 inline bool
 IsInBounds(const From from)
 {
-  return BoundsChecker<From, To>::check(from);
+  return BoundsChecker<From, To>::checkBounds(from);
 }
 
 } // namespace detail
 
 /**
  * Cast a value of integral type |From| to a value of integral type |To|,
  * asserting that the cast will be a safe cast per C++ (that is, that |to| is in
  * the range of values permitted for the type |From|).