Bug 224093

Summary: ICU 69 Deprecates ubrk_safeClone in favor of ubrk_clone
Product: WebKit Reporter: Don Olmstead <don.olmstead>
Component: JavaScriptCoreAssignee: Ross Kirsling <ross.kirsling>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ews-watchlist, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=224511
Attachments:
Description Flags
WIP Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch for landing none

Don Olmstead
Reported 2021-04-01 19:43:06 PDT
...
Attachments
WIP Patch (1.89 KB, patch)
2021-04-01 19:47 PDT, Don Olmstead
no flags
Patch (15.58 KB, patch)
2021-04-12 17:26 PDT, Ross Kirsling
no flags
Patch (15.69 KB, patch)
2021-04-12 17:30 PDT, Ross Kirsling
ews-feeder: commit-queue-
Patch (15.72 KB, patch)
2021-04-12 17:49 PDT, Ross Kirsling
no flags
Patch for landing (15.61 KB, patch)
2021-04-12 18:34 PDT, Ross Kirsling
no flags
Don Olmstead
Comment 1 2021-04-01 19:47:21 PDT
Created attachment 424978 [details] WIP Patch
Yusuke Suzuki
Comment 2 2021-04-02 01:01:10 PDT
Comment on attachment 424978 [details] WIP Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424978&action=review > Source/JavaScriptCore/runtime/IntlSegmenter.cpp:129 > + auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(ubrk_clone(m_segmenter.get(), &status)); Since ubrk_clone is draft status, we need to hide U_HIDE_DRAFT_API definition to use it. So I suggest, 1. Let's create a new cpp/h files, IntlWorkaround.h IntlWorkaround.cpp 2. Annotate @no-unify to IntlWorkaround.cpp since we want to avoid including unicode/ubrk.h without removing U_HIDE_DRAFT_API 3. Define a wrapper function around ubrk_clone / ubrk_safeClone in IntlWorkaround.cpp. To use draft ICU APIs, we need some special handling. Please check IntlListFormat.cpp for example :)
Yusuke Suzuki
Comment 3 2021-04-02 02:55:08 PDT
Comment on attachment 424978 [details] WIP Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424978&action=review >> Source/JavaScriptCore/runtime/IntlSegmenter.cpp:129 >> + auto segmenter = std::unique_ptr<UBreakIterator, UBreakIteratorDeleter>(ubrk_clone(m_segmenter.get(), &status)); > > Since ubrk_clone is draft status, we need to hide U_HIDE_DRAFT_API definition to use it. So I suggest, > > 1. Let's create a new cpp/h files, IntlWorkaround.h IntlWorkaround.cpp > 2. Annotate @no-unify to IntlWorkaround.cpp since we want to avoid including unicode/ubrk.h without removing U_HIDE_DRAFT_API > 3. Define a wrapper function around ubrk_clone / ubrk_safeClone in IntlWorkaround.cpp. To use draft ICU APIs, we need some special handling. Please check IntlListFormat.cpp for example :) Or let's define a helper function in IntlSegmenter.cpp, make it @no-unify, and include the ubrk.h with appropriate or #define. And ensure that ubrk.h is not included without draft's #define for that file.
Radar WebKit Bug Importer
Comment 4 2021-04-08 19:44:12 PDT
Ross Kirsling
Comment 5 2021-04-12 17:26:24 PDT
Ross Kirsling
Comment 6 2021-04-12 17:30:58 PDT
Ross Kirsling
Comment 7 2021-04-12 17:49:31 PDT
Yusuke Suzuki
Comment 8 2021-04-12 18:18:25 PDT
Comment on attachment 425820 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425820&action=review r=me with some comments. > Source/JavaScriptCore/runtime/IntlWorkaround.cpp:41 > +#if HAVE(ICU_UBRK_CLONE) > +#define U_HIDE_DRAFT_API 1 > +#endif I think we do not need to make it back since this cpp file is isolated. > Source/JavaScriptCore/runtime/IntlWorkaround.cpp:50 > +return ubrk_clone(iterator, status); 4 spaces for indentation. > Source/JavaScriptCore/runtime/IntlWorkaround.cpp:52 > +return ubrk_safeClone(iterator, nullptr, nullptr, status); Ditto.
Ross Kirsling
Comment 9 2021-04-12 18:34:38 PDT
Created attachment 425822 [details] Patch for landing
EWS
Comment 10 2021-04-12 19:04:23 PDT
Committed r275856 (236421@main): <https://commits.webkit.org/236421@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 425822 [details].
Darin Adler
Comment 11 2021-04-13 12:45:11 PDT
Comment on attachment 425822 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=425822&action=review > Source/JavaScriptCore/runtime/IntlSegmenter.h:80 > +// Abstraction to call ubrk_safeClone or ubrk_clone depending on ICU version. > +// This is implemented in IntlWorkaround.cpp in order to confine draft API visibility. > +UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*); Why is this here instead of an IntlWorkaround.h header? > Source/JavaScriptCore/runtime/IntlWorkaround.cpp:42 > +UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*); Why is this declaration repeated here instead of including the header it’s in?
Ross Kirsling
Comment 12 2021-04-13 14:18:37 PDT
(In reply to Darin Adler from comment #11) > Comment on attachment 425822 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=425822&action=review > > > Source/JavaScriptCore/runtime/IntlSegmenter.h:80 > > +// Abstraction to call ubrk_safeClone or ubrk_clone depending on ICU version. > > +// This is implemented in IntlWorkaround.cpp in order to confine draft API visibility. > > +UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*); > > Why is this here instead of an IntlWorkaround.h header? > > > Source/JavaScriptCore/runtime/IntlWorkaround.cpp:42 > > +UBreakIterator* cloneUBreakIterator(const UBreakIterator*, UErrorCode*); > > Why is this declaration repeated here instead of including the header it’s > in? Er right, I guess we should be able to put the declaration in an IntlWorkaround.h after all. (This was meant to be less confusing than introducing a IntlWorkaround.h and having IntlWorkaround.cpp *not* include it. However, the reason for that was because IntlSegmenter.h still needs to include ubrk.h in the usual way and I'd been trying to have IntlWorkaround "manage inclusion" of ubrk.h. But as long as we don't muck with the include in IntlSegmenter.h, then IntlWorkaround.h can safely house a declaration and nothing more.)
Note You need to log in before you can comment on or make changes to this bug.