Bug 1365460 - Define MOZ_DIAGNOSTIC_ASSERT_ENABLED when MOZ_DIAGNOSTIC_ASSERT does something. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 18 May 2017 11:14:17 +0900
changeset 359122 c174e6090f9e8779a5aecdbed2b645a0085930a7
parent 359121 3f4357f9aa1e3efc7d08b479c4226d9d2f5bf631
child 359123 1af2e006c4c1830f6b2f90dadd3c5d9ec1e92f19
push id31849
push userryanvm@gmail.com
push dateFri, 19 May 2017 15:38:10 +0000
treeherdermozilla-central@52b207e50972 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1365460
milestone55.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 1365460 - Define MOZ_DIAGNOSTIC_ASSERT_ENABLED when MOZ_DIAGNOSTIC_ASSERT does something. r=froydnj
mfbt/Assertions.h
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -359,16 +359,19 @@ MOZ_END_EXTERN_C
  * MOZ_RELEASE_ASSERT, which applies to non-debug builds as well.
  *
  * MOZ_DIAGNOSTIC_ASSERT works like MOZ_RELEASE_ASSERT in Nightly/Aurora and
  * MOZ_ASSERT in Beta/Release - use this when a condition is potentially rare
  * enough to require real user testing to hit, but is not security-sensitive.
  * This can cause user pain, so use it sparingly. If a MOZ_DIAGNOSTIC_ASSERT
  * is firing, it should promptly be converted to a MOZ_ASSERT while the failure
  * is being investigated, rather than letting users suffer.
+ *
+ * MOZ_DIAGNOSTIC_ASSERT_ENABLED is defined when MOZ_DIAGNOSTIC_ASSERT is like
+ * MOZ_RELEASE_ASSERT rather than MOZ_ASSERT.
  */
 
 /*
  * Implement MOZ_VALIDATE_ASSERT_CONDITION_TYPE, which is used to guard against
  * accidentally passing something unintended in lieu of an assertion condition.
  */
 
 #ifdef __cplusplus
@@ -441,18 +444,22 @@ struct AssertionConditionType
 #ifdef DEBUG
 #  define MOZ_ASSERT(...) MOZ_RELEASE_ASSERT(__VA_ARGS__)
 #else
 #  define MOZ_ASSERT(...) do { } while (0)
 #endif /* DEBUG */
 
 #ifdef RELEASE_OR_BETA
 #  define MOZ_DIAGNOSTIC_ASSERT MOZ_ASSERT
+#  ifdef DEBUG
+#    define MOZ_DIAGNOSTIC_ASSERT_ENABLED 1
+#  endif
 #else
 #  define MOZ_DIAGNOSTIC_ASSERT MOZ_RELEASE_ASSERT
+#  define MOZ_DIAGNOSTIC_ASSERT_ENABLED 1
 #endif
 
 /*
  * MOZ_ASSERT_IF(cond1, cond2) is equivalent to MOZ_ASSERT(cond2) if cond1 is
  * true.
  *
  *   MOZ_ASSERT_IF(isPrime(num), num == 2 || isOdd(num));
  *