MOZ_DIAGNOSTIC_CRASH() is now available

48 views
Skip to first unread message

Andrew McCreight

unread,
Nov 22, 2024, 10:52:12 AM11/22/24
to dev-platform
In bug 1931877, I added MOZ_DIAGNOSTIC_CRASH(), which takes a string argument. This acts like MOZ_CRASH() in debug and early beta or earlier builds and does nothing otherwise. This means that you no longer need to use MOZ_DIAGNOSTIC_ASSERTION(false) to achieve this effect.

Besides being more convenient, my motivation was to discourage people from using MOZ_ASSERTION(false) without a message, because then we end up with crash reports where the crash message is just "false", which makes it difficult to distinguish different instances if you are searching using the crash reason field. I haven't seen this be a problem yet, but better to fix it before it is.

I also converted over the 60 or so places that were doing MOZ_DIAGNOSTIC_ASSERTION(false) with a message to use MOZ_DIAGNOSTIC_CRASH(), and I'll shortly be putting a patch up in bug 1931874 to convert the dozen or so places that were using MOZ_DIAGNOSTIC_ASSERTION(false) without a message.

Andrew
Reply all
Reply to author
Forward
0 new messages