зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1620152 - Part 3: Implement MOZ_ALWAYS_TRUE()/etc using MOZ_DIAGNOSTIC_ASSERT() instead of MOZ_ASSERT(). r=froydnj
MOZ_ALWAYS_TRUE() evaluates its expression in both debug and release builds. This bug will change MOZ_ALWAYS_TRUE() to use MOZ_DIAGNOSTIC_ASSERT() instead of MOZ_ASSERT() so it will also assert in Nightly and DevEdition release builds. Differential Revision: https://phabricator.services.mozilla.com/D66921 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
57bd1629c7
Коммит
fbe277226d
|
@ -665,16 +665,17 @@ struct AssertionConditionType {
|
|||
|
||||
/*
|
||||
* MOZ_ALWAYS_TRUE(expr) and friends always evaluate the provided expression,
|
||||
* in debug builds and in release builds both. Then, in debug builds only, the
|
||||
* value of the expression is asserted either true or false using MOZ_ASSERT.
|
||||
* in debug builds and in release builds both. Then, in debug builds and
|
||||
* Nightly and DevEdition release builds, the value of the expression is
|
||||
* asserted either true or false using MOZ_DIAGNOSTIC_ASSERT.
|
||||
*/
|
||||
#define MOZ_ALWAYS_TRUE(expr) \
|
||||
do { \
|
||||
if (MOZ_LIKELY(expr)) { \
|
||||
/* Silence MOZ_MUST_USE. */ \
|
||||
} else { \
|
||||
MOZ_ASSERT(false, #expr); \
|
||||
} \
|
||||
#define MOZ_ALWAYS_TRUE(expr) \
|
||||
do { \
|
||||
if (MOZ_LIKELY(expr)) { \
|
||||
/* Silence MOZ_MUST_USE. */ \
|
||||
} else { \
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, #expr); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define MOZ_ALWAYS_FALSE(expr) MOZ_ALWAYS_TRUE(!(expr))
|
||||
|
|
Загрузка…
Ссылка в новой задаче