Bug 121436

Summary: Buildfix in WebResourceBuffer.h to make GCC 4.6 happy
Product: WebKit Reporter: Csaba Osztrogonác <ossy>
Component: New BugsAssignee: Csaba Osztrogonác <ossy>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, kbalazs, ossy, skyul
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 110141    
Attachments:
Description Flags
Patch none

Csaba Osztrogonác
Reported 2013-09-16 08:51:49 PDT
WebResourceBuffer.h is only used by NetworkProcess now and the following build failure was revealed by https://bugs.webkit.org/show_bug.cgi?id=110141: /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp:34:1: error: prototype for ‘WebKit::WebResourceBuffer::WebResourceBuffer(WTF::PassRefPtr<WebKit::ShareableResource>)’ does not match any in class ‘WebKit::WebResourceBuffer’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:36:7: error: candidates are: WebKit::WebResourceBuffer::WebResourceBuffer(const WebKit::WebResourceBuffer&) /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:47:5: error: WebKit::WebResourceBuffer::WebResourceBuffer(WTF::PassRefPtr<ShareableResource>) /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp: In member function ‘virtual const char* WebKit::WebResourceBuffer::data() const’: /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp:46:52: error: invalid use of incomplete type ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:32:7: error: forward declaration of ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp: In member function ‘virtual unsigned int WebKit::WebResourceBuffer::size() const’: /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp:51:22: error: invalid use of incomplete type ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:32:7: error: forward declaration of ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp: In member function ‘virtual bool WebKit::WebResourceBuffer::isEmpty() const’: /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp:56:38: error: invalid use of incomplete type ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:32:7: error: forward declaration of ‘struct ShareableResource’ In file included from /home/ossy/WebKitNix/Source/WTF/wtf/RefPtr.h:29:0, from /home/ossy/WebKitNix/Source/WTF/wtf/VectorTraits.h:26, from /home/ossy/WebKitNix/Source/WTF/wtf/Vector.h:31, from /home/ossy/WebKitNix/Source/WebCore/platform/SharedBuffer.h:33, from /home/ossy/WebKitNix/Source/WebCore/loader/ResourceBuffer.h:29, from /home/ossy/WebKitNix/WebKitBuild/Release/DerivedSources/WebKit2/include/WebCore/ResourceBuffer.h:1, from /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:30, from /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.cpp:27: /home/ossy/WebKitNix/Source/WTF/wtf/PassRefPtr.h: In function ‘void WTF::derefIfNotNull(T*) [with T = ShareableResource]’: /home/ossy/WebKitNix/Source/WTF/wtf/PassRefPtr.h:67:39: instantiated from ‘WTF::PassRefPtr<T>::~PassRefPtr() [with T = ShareableResource]’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:38:137: instantiated from here /home/ossy/WebKitNix/Source/WTF/wtf/PassRefPtr.h:52:13: error: invalid use of incomplete type ‘struct ShareableResource’ /home/ossy/WebKitNix/Source/WebKit2/Shared/WebResourceBuffer.h:32:7: error: forward declaration of ‘struct ShareableResource’ related comments: ------------------ -https://bugs.webkit.org/show_bug.cgi?id=110141#c8 Kwang Yul Seo: "Changed forward declaration of ShareableResource to actual include because GCC requires a definition of the type for passing it in a PassOwnPtr." - https://bugs.webkit.org/show_bug.cgi?id=110141#c11 Brady Eidson: " The ChangeLog indicates this undesirable change is because of GCC requirements. Why does GCC have this deficiency? Was the deficiency in GCC fixed in a later version? There's been a vocal and public push to move the compiler dependencies in the project forward, and WebKit2 has traditionally been the flagship of this effort. Is it truly unavoidable to have to make this type of change?" - https://bugs.webkit.org/show_bug.cgi?id=110141#c12 Kwang Yul Seo: "This change was in the original patch written by Balazs Kelemen. I double-checked and found that this is not needed at least in GCC 4.7. I will revert the change because we already limit the supported compilers to GCC >= 4.7 and Clang >= 3.0 (Bug 109932). Balazs, do you remember the version of GCC you had this problem?" - https://bugs.webkit.org/show_bug.cgi?id=110141#c21 by me - https://bugs.webkit.org/show_bug.cgi?id=110141#c22 by kbalazs - https://bugs.webkit.org/show_bug.cgi?id=110141#c23 by me
Attachments
Patch (1.56 KB, patch)
2013-09-16 08:56 PDT, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2013-09-16 08:56:12 PDT
Created attachment 211795 [details] Patch I don't think if we should drop GCC 4.6 (default GCC on the latest Ubuntu LTS - 12.04) support at all if we can fix it with this simple patch.
Darin Adler
Comment 2 2013-09-16 11:27:26 PDT
Comment on attachment 211795 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211795&action=review > Source/WebKit2/ChangeLog:12 > + * Shared/WebResourceBuffer.h: Changed forward declaration of ShareableResource to > + actual include because GCC requires a definition of the type for passing it in a PassOwnPtr. That explanation doesn’t make sense. This header doesn’t have any PassOwnPtr.
Darin Adler
Comment 3 2013-09-16 11:28:18 PDT
Comment on attachment 211795 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211795&action=review > Source/WebKit2/Shared/WebResourceBuffer.h:29 > +#include "ShareableResource.h" Does adding this include to the WebResourceBuffer.cpp file fix the compilation of that file? I don’t think this is needed in the header.
Csaba Osztrogonác
Comment 4 2013-09-16 12:12:09 PDT
Comment on attachment 211795 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211795&action=review >> Source/WebKit2/ChangeLog:12 >> + actual include because GCC requires a definition of the type for passing it in a PassOwnPtr. > > That explanation doesn’t make sense. This header doesn’t have any PassOwnPtr. Good point, it seems it was a typo, not PassOwnPtr, but PassRefPtr. >> Source/WebKit2/Shared/WebResourceBuffer.h:29 >> +#include "ShareableResource.h" > > Does adding this include to the WebResourceBuffer.cpp file fix the compilation of that file? I don’t think this is needed in the header. Thanks the idea, maybe it is enough, I'll check it tomorrow.
Csaba Osztrogonác
Comment 5 2013-09-17 08:03:11 PDT
I checked it again and it seems we don't need this workaround anymore after http://trac.webkit.org/changeset/155232/trunk/Source/WTF/wtf/PassRefPtr.h The problem was the hack removed by r155232 used inline instead of always inline. But now it works fine.
Note You need to log in before you can comment on or make changes to this bug.