RESOLVED FIXED 117146
Use ASSERT_DISABLED option for assertion purpose code in InlineBox
https://bugs.webkit.org/show_bug.cgi?id=117146
Summary Use ASSERT_DISABLED option for assertion purpose code in InlineBox
Kangil Han
Reported 2013-06-03 07:18:52 PDT
NDEBUG option is needed for any inInlineBoxDetach usage.
Attachments
Patch (1.25 KB, patch)
2013-06-03 07:21 PDT, Kangil Han
no flags
Patch (4.74 KB, patch)
2013-06-03 19:45 PDT, Kangil Han
no flags
Patch (3.73 KB, patch)
2013-06-03 23:55 PDT, Kangil Han
no flags
Kangil Han
Comment 1 2013-06-03 07:21:23 PDT
Tim Horton
Comment 2 2013-06-03 07:48:08 PDT
Comment on attachment 203586 [details] Patch This is already building and has been a long time, and ASSERTs are compiled out in release builds, so why do we need this?
Kangil Han
Comment 3 2013-06-03 07:54:51 PDT
(In reply to comment #2) > (From update of attachment 203586 [details]) > This is already building and has been a long time, and ASSERTs are compiled out in release builds, so why do we need this? Yes, this patch doesn't change any behavior in release(even debug) build. But would bring us a code consistency(readability). :)
Alexey Proskuryakov
Comment 4 2013-06-03 11:00:27 PDT
Comment on attachment 203586 [details] Patch You are right that the code is not quite correct - NDEBUG and ASSERT_DISABLED usually go hand in hand, but sometimes people do use release builds with assertions enabled, and this code will fail to build in this configuration. A better way to fix this is to change NDEBUG #ifs to ASSERT_DISABLED ones elsewhere in this file.
Kangil Han
Comment 5 2013-06-03 19:45:51 PDT
Kangil Han
Comment 6 2013-06-03 19:46:51 PDT
(In reply to comment #4) > (From update of attachment 203586 [details]) > You are right that the code is not quite correct - NDEBUG and ASSERT_DISABLED usually go hand in hand, but sometimes people do use release builds with assertions enabled, and this code will fail to build in this configuration. > > A better way to fix this is to change NDEBUG #ifs to ASSERT_DISABLED ones elsewhere in this file. Took ap's comment into consideration.
Alexey Proskuryakov
Comment 7 2013-06-03 23:16:56 PDT
Comment on attachment 203647 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=203647&action=review > Source/WebCore/rendering/InlineBox.cpp:35 > -#ifndef NDEBUG > +#if !ASSERT_DISABLED > #include <stdio.h> > #endif stdio.h is needed for code below that is genuinely DEBUG-specific, so this change is not correct. > Source/WebCore/rendering/InlineBox.cpp:95 > +#if !ASSERT_DISABLED > ASSERT(inInlineBoxDetach); > - > +#endif This instance doesn't need to be guarded - ASSERT macro itself has the check. > Source/WebCore/rendering/InlineBox.cpp:101 > -#ifndef NDEBUG > +#if !ASSERT_DISABLED > const char* InlineBox::boxName() const These functions are DEBUG specific, they are not related to assertions at all. So, NDEBUG was correct here. > Source/WebCore/rendering/InlineBox.cpp:395 > -#ifndef NDEBUG > +#if !ASSERT_DISABLED Ditto. > Source/WebCore/rendering/InlineBox.h:111 > -#ifndef NDEBUG > +#if !ASSERT_DISABLED Ditto. > Source/WebCore/rendering/InlineBox.h:439 > -#ifndef NDEBUG > +#if !ASSERT_DISABLED Ditto.
Kangil Han
Comment 8 2013-06-03 23:55:53 PDT
Kangil Han
Comment 9 2013-06-03 23:56:30 PDT
Thanks for the review and took ap's comment into consideration. :)
WebKit Commit Bot
Comment 10 2013-06-04 03:26:50 PDT
Comment on attachment 203656 [details] Patch Clearing flags on attachment: 203656 Committed r151164: <http://trac.webkit.org/changeset/151164>
WebKit Commit Bot
Comment 11 2013-06-04 03:26:53 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.