On 3/28/14, 12:25 PM, Benoit Jacob wrote:
Should we give typical code a macro that does what they want and sounds
like what they want? Really, what typical code wants is a no-operation
instead of undefined-behavior; now, that is exactly the same as
MOZ_ASSERT(false, "error"). Maybe this syntax is unnecessarily annoying,
and it would be worth adding a macro for that, i.e. similar to MOZ_CRASH
but only affecting DEBUG builds? What would be a good name for it? Is it
worth keeping a close analogy with the unreachable-marker macro to steer
people away from it --- e.g. maybe MOZ_UNREACHABLE_NO_OPERATION or even
just MOZ_UNREACHABLE? So that people couldn't miss it when they look for
"UNREACHABLE" macros?

How about replacing MOZ_ASSUME_UNREACHABLE with two new macros like:

#define MOZ_ASSERT_UNREACHABLE() \
  MOZ_ASSERT(false, "MOZ_ASSERT_UNREACHABLE")

#define MOZ_CRASH_UNREACHABLE()         \
  do {                                  \
    MOZ_ASSUME_UNREACHABLE_MARKER();    \
    MOZ_CRASH("MOZ_CRASH_UNREACHABLE"); \
  } while (0)


chris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to