Bug 36381

Summary: TextBreakIteratorICU.cpp is incompatible with new UBreakIterator type in ICU 4.4
Product: WebKit Reporter: Jeff Kowalczyk <jtk>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, gnome, plaes, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://bugs.gentoo.org/show_bug.cgi?id=308699
Attachments:
Description Flags
webkit-icu-4.4.patch
none
Patch mitz: review+

Description Jeff Kowalczyk 2010-03-19 12:09:43 PDT
Gentoo Linux ~amd64 added icu-4.4 recently. Webkit-gtk from git repository (currently 644f4138b) build fails with:

./doltlibtool --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I.  -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DWTF_USE_ICU_UNICODE=1   -DNDEBUG   -I./WebCore -I./WebCore/accessibility -I./WebCore/bindings/js -I./WebCore/bridge -I./WebCore/bridge/c -I./WebCore/bridge/jni/jsc -I./WebCore/bridge/jsc -I./WebCore/css -I./WebCore/dom -I./WebCore/dom/default -I./WebCore/editing -I./WebCore/history -I./WebCore/html -I./WebCore/html/canvas -I./WebCore/inspector -I./WebCore/loader -I./WebCore/loader/appcache -I./WebCore/loader/archive -I./WebCore/loader/icon -I./WebCore/mathml -I./WebCore/notifications -I./WebCore/page -I./WebCore/page/animation -I./WebCore/platform -I./WebCore/platform/animation -I./WebCore/platform/graphics -I./WebCore/platform/graphics/filters -I./WebCore/platform/graphics/transforms -I./WebCore/platform/image-decoders -I./WebCore/platform/image-decoders/bmp -I./WebCore/platform/image-decoders/gif -I./WebCore/platform/image-decoders/ico -I./WebCore/platform/image-decoders/jpeg -I./WebCore/platform/image-decoders/png -I./WebCore/platform/mock -I./WebCore/platform/network -I./WebCore/platform/sql -I./WebCore/platform/text -I./WebCore/plugins -I./WebCore/rendering -I./WebCore/rendering/style -I./WebCore/storage -I./WebCore/svg -I./WebCore/svg/animation -I./WebCore/svg/graphics -I./WebCore/svg/graphics/filters -I./WebCore/websockets -I./WebCore/wml -I./WebCore/workers -I./WebCore/xml -I./WebCore/bindings/js -DDATA_DIR=\"/usr/share\" -DENABLE_CHANNEL_MESSAGING=1  -DENABLE_DATAGRID=0 -DENABLE_PROGRESS_TAG=0 -DENABLE_JAVASCRIPT_DEBUGGER=1  -DENABLE_OFFLINE_WEB_APPLICATIONS=1 -DENABLE_DATABASE=1  -DENABLE_DATALIST=1 -DENABLE_EVENTSOURCE=1 -DENABLE_DOM_STORAGE=1 -DENABLE_ICONDATABASE=1   -DENABLE_VIDEO=1    -DENABLE_RUBY=1 -DENABLE_XPATH=1 -DENABLE_XSLT=1 -DENABLE_WORKERS=1 -DENABLE_SHARED_WORKERS=1  -DENABLE_FILTERS=1    -DENABLE_SVG=1 -DENABLE_SVG_USE=1 -DENABLE_SVG_FOREIGN_OBJECT=1 -DENABLE_SVG_FONTS=1 -DENABLE_SVG_AS_IMAGE=1 -DENABLE_SVG_ANIMATION=1  -DENABLE_WEB_SOCKETS=0   -DWTF_USE_SOUP=1 -I./WebCore/accessibility/gtk -I./WebCore/loader/gtk -I./WebCore/page/gtk -I./WebCore/platform/graphics/cairo -I./WebCore/platform/graphics/gstreamer -I./WebCore/platform/graphics/gtk -I./WebCore/platform/gtk -I./WebCore/platform/network/soup  -DUSE_PANGO=1 -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/parser -I./JavaScriptCore/wtf -I./JavaScriptCore/wtf/gtk -I./JavaScriptCore/wtf/gobject -I./DerivedSources -I./JavaScriptCore -I./JavaScriptCore/API -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/interpreter -I./JavaScriptCore/bytecode -I./JavaScriptCore/bytecompiler -I./JavaScriptCore/debugger -I./JavaScriptCore/jit -I./JavaScriptCore/pcre -I./JavaScriptCore/profiler -I./JavaScriptCore/runtime -I./JavaScriptCore/jit -I./JavaScriptCore/assembler -I./JavaScriptCore/wtf/unicode -I./JavaScriptCore/yarr -I./JavaScriptCore/pcre -I./JavaScriptCore/parser -I./JavaScriptCore/runtime -DXP_UNIX -DBUILDING_WEBKIT -DPACKAGE_LOCALE_DIR=\"/usr/share/locale\" -DDATA_DIR=\"/usr/share\" -I./WebKit/gtk -I./WebKit/gtk/WebCoreSupport -I./WebKit/gtk/webkit -I./WebKit/gtk/webkit   -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-rtti -fno-strict-aliasing  -pthread -I/usr/include/enchant -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -pthread -I/usr/include/gail-1.0 -I/usr/include/atk-1.0 -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/gtk-2.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12    -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2   -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12    -pthread -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include/libxml2   -I/usr/include/libxml2    -I/usr/include   -march=core2 -O2 -pipe  -MT WebCore/platform/text/libwebkit_1_0_la-TextBreakIteratorICU.lo -MD -MP -MF WebCore/platform/text/.deps/libwebkit_1_0_la-TextBreakIteratorICU.Tpo -c -o WebCore/platform/text/libwebkit_1_0_la-TextBreakIteratorICU.lo `test -f 'WebCore/platform/text/TextBreakIteratorICU.cpp' || echo './'`WebCore/platform/text/TextBreakIteratorICU.cpp
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'WebCore::TextBreakIterator* WebCore::setUpIterator(bool&, WebCore::TextBreakIterator*&, UBreakIteratorType, const UChar*, int)':
WebCore/platform/text/TextBreakIteratorICU.cpp:41: error: invalid static_cast from type 'UBreakIterator*' to type 'WebCore::TextBreakIterator*'
WebCore/platform/text/TextBreakIteratorICU.cpp:49: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'void ubrk_setText_44(UBreakIterator*, const UChar*, int32_t, UErrorCode*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakFirst(WebCore::TextBreakIterator*)':
WebCore/platform/text/TextBreakIteratorICU.cpp:90: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_first_44(UBreakIterator*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakLast(WebCore::TextBreakIterator*)':
WebCore/platform/text/TextBreakIteratorICU.cpp:95: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_last_44(UBreakIterator*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakNext(WebCore::TextBreakIterator*)':
WebCore/platform/text/TextBreakIteratorICU.cpp:100: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_next_44(UBreakIterator*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakPrevious(WebCore::TextBreakIterator*)':
WebCore/platform/text/TextBreakIteratorICU.cpp:105: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_previous_44(UBreakIterator*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakPreceding(WebCore::TextBreakIterator*, int)':
WebCore/platform/text/TextBreakIteratorICU.cpp:110: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_preceding_44(UBreakIterator*, int32_t)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakFollowing(WebCore::TextBreakIterator*, int)':
WebCore/platform/text/TextBreakIteratorICU.cpp:115: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'int32_t ubrk_following_44(UBreakIterator*, int32_t)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'int WebCore::textBreakCurrent(WebCore::TextBreakIterator*)':
WebCore/platform/text/TextBreakIteratorICU.cpp:120: error: cannot convert 'WebCore::TextBreakIterator*' to 'const UBreakIterator*' for argument '1' to 'int32_t ubrk_current_44(const UBreakIterator*)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'bool WebCore::isTextBreak(WebCore::TextBreakIterator*, int)':
WebCore/platform/text/TextBreakIteratorICU.cpp:125: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'UBool ubrk_isBoundary_44(UBreakIterator*, int32_t)'
WebCore/platform/text/TextBreakIteratorICU.cpp: In function 'WebCore::TextBreakIterator* WebCore::setUpIteratorWithRules(bool&, WebCore::TextBreakIterator*&, const char*, const UChar*, int)':
WebCore/platform/text/TextBreakIteratorICU.cpp:139: error: invalid static_cast from type 'UBreakIterator*' to type 'WebCore::TextBreakIterator*'
WebCore/platform/text/TextBreakIteratorICU.cpp:147: error: cannot convert 'WebCore::TextBreakIterator*' to 'UBreakIterator*' for argument '1' to 'void ubrk_setText_44(UBreakIterator*, const UChar*, int32_t, UErrorCode*)'
make[1]: *** [WebCore/platform/text/libwebkit_1_0_la-TextBreakIteratorICU.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
mv -f WebCore/bindings/js/.deps/libwebkit_1_0_la-ScriptControllerGtk.Tpo WebCore/bindings/js/.deps/libwebkit_1_0_la-ScriptControllerGtk.Plo
make[1]: Leaving directory `/var/tmp/portage/net-libs/webkit-gtk-9999/work/webkit-gtk-9999'
make: *** [all] Error 2
 * ERROR: net-libs/webkit-gtk-9999 failed:
 *   emake failed
 * 
 * Call stack:
 *     ebuild.sh, line   54:  Called src_compile
 *   environment, line 3159:  Called _eapi2_src_compile
 *     ebuild.sh, line  646:  Called die
 * The specific snippet of code:
 *              emake || die "emake failed"
 * 
 * If you need support, post the output of 'emerge --info =net-libs/webkit-gtk-9999',
 * the complete build log and the output of 'emerge -pqv =net-libs/webkit-gtk-9999'.
 * This ebuild is from an overlay named 'wirelay': '/var/lib/layman/wirelay/'
 * The complete build log is located at '/var/tmp/portage/net-libs/webkit-gtk-9999/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-libs/webkit-gtk-9999/temp/environment'.
 * S: '/var/tmp/portage/net-libs/webkit-gtk-9999/work/webkit-gtk-9999'
Comment 1 Priit Laes (IRC: plaes) 2010-03-19 23:57:57 PDT
There's patch to fix this issue in FreeBSD port collection:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/webkit-gtk2/files/
Comment 2 Priit Laes (IRC: plaes) 2010-03-20 13:43:49 PDT
Created attachment 51230 [details]
webkit-icu-4.4.patch
Comment 3 WebKit Review Bot 2010-03-20 13:46:29 PDT
Attachment 51230 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/platform/text/TextBreakIterator.h:30:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
WebCore/platform/text/TextBreakIterator.h:29:  More than one command on the same line in if  [whitespace/parens] [4]
Total errors found: 2 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Darin Adler 2010-03-20 14:03:57 PDT
Comment on attachment 51230 [details]
webkit-icu-4.4.patch

Fixing this should not require any changes to the header file. The changes should be inside TextBreakIteratorICU.cpp with no changes to header files.

Since ICU has changed the type UBreakIterator from a void to an actual type, the type casts involving UBreakIterator should now be reinterpret_cast rather than static_cast.
Comment 5 Darin Adler 2010-03-20 14:18:11 PDT
Created attachment 51233 [details]
Patch
Comment 6 Priit Laes (IRC: plaes) 2010-03-21 00:04:51 PDT
(In reply to comment #5)
> Created an attachment (id=51233) [details]
> Patch

Confirmed to be working with icu-4.4 :)
Comment 7 Darin Adler 2010-03-22 10:52:11 PDT
Committed r56345: <http://trac.webkit.org/changeset/56345>