Skip to content

Commit

Permalink
Bug 1129247 - Introduce MOZ_DIAGNOSTIC_ASSERT. r=Waldo
Browse files Browse the repository at this point in the history
  • Loading branch information
bholley committed Feb 4, 2015
1 parent 591f263 commit ed086d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mfbt/Assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ __declspec(noreturn) __inline void MOZ_NoReturn() {}
* MOZ_ASSERT has no effect in non-debug builds. It is designed to catch bugs
* *only* during debugging, not "in the field". If you want the latter, use
* 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.
*/

/*
Expand Down Expand Up @@ -378,6 +385,12 @@ struct AssertionConditionType
# define MOZ_ASSERT(...) do { } while (0)
#endif /* DEBUG */

#ifdef RELEASE_BUILD
# define MOZ_DIAGNOSTIC_ASSERT MOZ_ASSERT
#else
# define MOZ_DIAGNOSTIC_ASSERT MOZ_RELEASE_ASSERT
#endif

/*
* MOZ_ASSERT_IF(cond1, cond2) is equivalent to MOZ_ASSERT(cond2) if cond1 is
* true.
Expand Down

0 comments on commit ed086d3

Please sign in to comment.