Bug 18507

Summary: compilation error while building with gcc < 4.x compilers on latest nightlies
Product: WebKit Reporter: Srinivas Rao M Hamse <msrinirao>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Suggested patch for this bug
eric: review-
latest patch
none
better patch
none
corrected patch mjs: review+

Description Srinivas Rao M Hamse 2008-04-14 23:20:16 PDT
While trying to build WebKit-r31848(or any latest nightlies),  
Compilation breaks if we compile using GCC compilers with gcc version less than 4. I got this error with my gcc version 3.4.6.

compilation breaks while doing:

arm-linux-g++ -DHAVE_CONFIG_H -I. -I.. -DWTF_USE_ICU_UNICODE=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DNDEBUG -DENABLE_ICONDATABASE=0 -I../JavaScriptCore -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf -I../JavaScriptCore/kjs -I./DerivedSources -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/kjs -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2 -fno-rtti -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 -fno-exceptions -pthread -I/home/srinirao/webkit/myprefix/include/glib-2.0 -I/home/srinirao/webkit/myprefix/lib/glib-2.0/include -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2 -I/home/srinirao/webkit/myprefix/include/readline -D_REENTRANT -I/home/srinirao/webkit/myprefix/include -fno-strict-aliasing -O2 -MT JavaScriptCore/kjs/libJavaScriptCore_la-JSGlobalObject.lo -MD -MP -MF JavaScriptCore/kjs/.deps/libJavaScriptCore_la-JSGlobalObject.Tpo -c ../JavaScriptCore/kjs/JSGlobalObject.cpp  -fPIC -DPIC -o JavaScriptCore/kjs/.libs/libJavaScriptCore_la-JSGlobalObject.o
mv -f JavaScriptCore/kjs/.deps/libJavaScriptCore_la-JSGlobalObject.Tpo JavaScriptCore/kjs/.deps/libJavaScriptCore_la-JSGlobalObject.Plo
/bin/sh ./libtool --tag=CXX   --mode=compile arm-linux-g++ -DHAVE_CONFIG_H -I. -I..  -DWTF_USE_ICU_UNICODE=1 -DBUILDING_GTK__=1 -DWTF_CHANGES   -DNDEBUG  -DENABLE_ICONDATABASE=0  -I../JavaScriptCore -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf -I../JavaScriptCore/kjs -I./DerivedSources -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/kjs -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2  -fno-rtti -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 -fno-exceptions  -pthread -I/home/srinirao/webkit/myprefix/include/glib-2.0 -I/home/srinirao/webkit/myprefix/lib/glib-2.0/include   -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2 -I/home/srinirao/webkit/myprefix/include/readline -D_REENTRANT -I/home/srinirao/webkit/myprefix/include -fno-strict-aliasing -O2 -MT JavaScriptCore/kjs/libJavaScriptCore_la-AllInOneFile.lo -MD -MP -MF JavaScriptCore/kjs/.deps/libJavaScriptCore_la-AllInOneFile.Tpo -c -o JavaScriptCore/kjs/libJavaScriptCore_la-AllInOneFile.lo `test -f 'JavaScriptCore/kjs/AllInOneFile.cpp' || echo '../'`JavaScriptCore/kjs/AllInOneFile.cpp
 arm-linux-g++ -DHAVE_CONFIG_H -I. -I.. -DWTF_USE_ICU_UNICODE=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DNDEBUG -DENABLE_ICONDATABASE=0 -I../JavaScriptCore -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf -I../JavaScriptCore/kjs -I./DerivedSources -I../JavaScriptCore/ForwardingHeaders -I../JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/kjs -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2 -fno-rtti -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 -fno-exceptions -pthread -I/home/srinirao/webkit/myprefix/include/glib-2.0 -I/home/srinirao/webkit/myprefix/lib/glib-2.0/include -I/home/srinirao/webkit/myprefix/include -I/home/srinirao/webkit/myprefix/../../../libs/libjpeg -I/home/srinirao/webkit/myprefix/include/freetype2 -I/home/srinirao/webkit/myprefix/include/readline -D_REENTRANT -I/home/srinirao/webkit/myprefix/include -fno-strict-aliasing -O2 -MT JavaScriptCore/kjs/libJavaScriptCore_la-AllInOneFile.lo -MD -MP -MF JavaScriptCore/kjs/.deps/libJavaScriptCore_la-AllInOneFile.Tpo -c ../JavaScriptCore/kjs/AllInOneFile.cpp  -fPIC -DPIC -o JavaScriptCore/kjs/.libs/libJavaScriptCore_la-AllInOneFile.o
In file included from ../JavaScriptCore/kjs/AllInOneFile.cpp:40:
../JavaScriptCore/kjs/dtoa.cpp: In function `void kjs_freedtoa(char*)':
../JavaScriptCore/kjs/dtoa.cpp:2259: warning: cast from `char*' to `int*' increases required alignment of target type
In file included from ../JavaScriptCore/kjs/AllInOneFile.cpp:55:
../JavaScriptCore/kjs/nodes.cpp: At global scope:
../JavaScriptCore/kjs/nodes.h:213: error: `typedef enum KJS::ExpressionNode::CallerType KJS::ExpressionNode::CallerType' is protected
../JavaScriptCore/kjs/nodes.cpp:1090: error: within this context
make[1]: *** [JavaScriptCore/kjs/libJavaScriptCore_la-AllInOneFile.lo] Error 1
make[1]: Leaving directory `/home/srinirao/webkit/WebKit-r31848/objdir'
make: *** [all] Error 2

I will be submitting a patch for this bug.
Comment 1 Srinivas Rao M Hamse 2008-04-14 23:24:37 PDT
Created attachment 20545 [details]
Suggested patch for this bug

Attaching the patch for this bug. I am not sure whether it affects any other module. Please review it.
Comment 2 Eric Seidel (no email) 2008-04-14 23:39:56 PDT
Comment on attachment 20545 [details]
Suggested patch for this bug

Although darin's comment was kinda confusing on the list, the proper behavior is to mark the patch review=? instead of review=+

This patch requires a ChangeLog (see prepare-ChangeLog) before we can land it.  Thanks!
Comment 3 Srinivas Rao M Hamse 2008-04-15 00:22:52 PDT
Created attachment 20546 [details]
latest patch

Patch created using svn-createpatch on 31896
Prepared a Changelog entry
Comment 4 Srinivas Rao M Hamse 2008-04-15 23:53:41 PDT
Created attachment 20577 [details]
better patch

This patch contains no ifdefs to check the compiler.  But the line with typedef is made public in order for the compilation with GCC 3.x go through. Done after discussing with Eric Seidel and Maciej Stachowiak on IRC
Comment 5 Srinivas Rao M Hamse 2008-04-16 22:40:42 PDT
Created attachment 20612 [details]
corrected patch

Added the Changelog comment
Comment 6 Maciej Stachowiak 2008-04-16 22:43:06 PDT
Comment on attachment 20612 [details]
corrected patch

r=me
Comment 7 Mark Rowe (bdash) 2008-04-17 23:41:53 PDT
Landed in r31991.