From ed086d30f88049097541f5da8463a1079a278e67 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 4 Feb 2015 13:13:58 -0800 Subject: [PATCH] Bug 1129247 - Introduce MOZ_DIAGNOSTIC_ASSERT. r=Waldo --- mfbt/Assertions.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h index 5443329a545a9..6836f2d95a04c 100644 --- a/mfbt/Assertions.h +++ b/mfbt/Assertions.h @@ -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. */ /* @@ -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.