NEW 209677
Move from NDEBUG to ASSERT_ENABLED in all places
https://bugs.webkit.org/show_bug.cgi?id=209677
Summary Move from NDEBUG to ASSERT_ENABLED in all places
Keith Miller
Reported 2020-03-27 12:38:57 PDT
Move from NDEBUG to ASSERT_ENABLED in all places
Attachments
Patch (262.41 KB, patch)
2020-03-27 12:48 PDT, Keith Miller
no flags
Keith Miller
Comment 1 2020-03-27 12:48:32 PDT
EWS Watchlist
Comment 2 2020-03-27 12:49:46 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Darin Adler
Comment 3 2020-03-27 14:54:12 PDT
This is a good change. There’s a bit of irony in all this motion, though. What NDEBUG *really* means is "disable the assertions in <assert.h> in the standard library"; we just decided to key off it for some of our own assertions too. There’s no reason we *need* to set NDEBUG when we turn on optimizations, so we could also have accomplished some of what we wanted to here by simply *not* setting NDEBUG in the Release+Assert build. Worth finding out if we are using NDEBUG for anything any more after this. And if so, is it something that should really be tied to <assert.h> or not. We could use a macro with a name that makes more sense to us instead.
Alexey Proskuryakov
Comment 4 2020-03-27 15:08:25 PDT
This looks like a mass replace. I'm not certain about changes like this: -#ifndef NDEBUG +#if ASSERT_ENABLED const char* debugName() const { return BankInfo::debugName(regID()); Why would this debugging facility be tied to ASSERT_ENABLED?
Darin Adler
Comment 5 2020-03-27 15:11:24 PDT
If we’re truly doing a global replace, then we should just "not set NDEBUG" instead. Disentangling other debugging mechanisms from ASSERT_ENABLED might be useful, but can’t be done with global replace.
Keith Miller
Comment 6 2020-03-27 15:15:16 PDT
(In reply to Alexey Proskuryakov from comment #4) > This looks like a mass replace. I'm not certain about changes like this: > > -#ifndef NDEBUG > +#if ASSERT_ENABLED > const char* debugName() const > { > return BankInfo::debugName(regID()); > > Why would this debugging facility be tied to ASSERT_ENABLED? I'm not really sure why that's only enabled on debug anyway 🤷‍♂️...
Keith Miller
Comment 7 2020-03-27 15:20:38 PDT
(In reply to Darin Adler from comment #5) > If we’re truly doing a global replace, then we should just "not set NDEBUG" > instead. Maybe, on the other hand writing code that says #ifndef NDEBUG is very confusing. 95%+ of the time you're adding code for assertions. IMO, it makes more sense to have an ASSERT_ENABLED over the double negation everywhere. > > Disentangling other debugging mechanisms from ASSERT_ENABLED might be > useful, but can’t be done with global replace. I'm not totally convinced by this since it's not uncommon to have good error messages for your assertions. At least I try to do that. On the other hand I'm not sure why we are not always building it anyway. Maybe because of binary size?
Note You need to log in before you can comment on or make changes to this bug.