Bug 1365460 - Define MOZ_DIAGNOSTIC_ASSERT_ENABLED when MOZ_DIAGNOSTIC_ASSERT does something. r?froydnj
--- 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));
*