On Fri 28 Mar 2014 01:05:34 PM PDT, Benoit Jacob wrote: > 2014-03-28 13:23 GMT-04:00 Chris Peterson <[email protected]>: > >> 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) >> > > MOZ_ASSUME_UNREACHABLE_MARKER tells the compiler "feel free to arbitrarily > miscompile this, and anything from that point on in this branch, as you may > assume that this code is unreachable". So it doesn't really serve any > purpose to add a MOZ_CRASH after a MOZ_ASSUME_UNREACHABLE_MARKER.
MOZ_OPTIMIZE_FOR_UNREACHABLE? _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

