Heads up:

In 77 Nightly, I plan to reimplement MOZ_ALWAYS_TRUE() using MOZ_DIAGNOSTIC_ASSERT() instead of MOZ_ASSERT(). This is bug 1620152.

MOZ_ALWAYS_TRUE(X) and friends [1] are like MOZ_ASSERT(X), except they also evaluate the expression X in release builds. This is useful for silencing warnings about unused return values in code that produces side effects in release builds, but doesn't need explicit error checking. There are currently about 1200 uses of MOZ_ALWAYS_TRUE()/etc in mozilla-central.

MOZ_DIAGNOSTIC_ASSERT(X) will MOZ_RELEASE_ASSERT() the expression X in release builds of Nightly and DevEdition. This might trigger some new crash signatures or spikes in Nightly. MOZ_ALWAYS_TRUE()/etc will still evaluate the expression X in release builds of Beta or Release without aborting.

If a developer confidently opts for MOZ_ALWAYS_TRUE() instead of explicit error handling, the new diagnostic MOZ_ALWAYS_TRUE()/etc will give us more confidence that users don't actually hit an unchecked error in the wild.

[1]
MOZ_ALWAYS_TRUE
MOZ_ALWAYS_FALSE
MOZ_ALWAYS_SUCCEEDS (alias for MOZ_ALWAYS_TRUE(NS_SUCCEEDED()))
MOZ_ALWAYS_OK (alias for result.isOk())
MOZ_ALWAYS_ERR (alias for result.isErr())
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to