Bug 17538 - Can't build CollectorHeapIntrospector.cpp as a standalone file outside of AllInOneFile.cpp
Summary: Can't build CollectorHeapIntrospector.cpp as a standalone file outside of All...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Mark Mentovai
URL:
Keywords:
Depends on:
Blocks: 17493
  Show dependency treegraph
 
Reported: 2008-02-25 14:13 PST by Mark Mentovai
Modified: 2008-02-25 14:44 PST (History)
1 user (show)

See Also:


Attachments
Move the definition of CollectorHeap into collector.h, and provide a "using" declaration for WTF::RemoteMemoryReader (2.21 KB, patch)
2008-02-25 14:16 PST, Mark Mentovai
mrowe: review-
Details | Formatted Diff | Diff
v2, includes ChangeLog entry (3.00 KB, patch)
2008-02-25 14:37 PST, Mark Mentovai
mrowe: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Mentovai 2008-02-25 14:13:33 PST
Two problems are encountered when trying to build CollectorHeapIntrospector.cpp, a Mac-only file, as a standalone, as opposed to building it normally, which involves including it from AllInOneFile.cpp:

There's a forward-declaration problems: CollectorHeap needs to be visible to CollectorHeapIntrospector, but it's not visible from collector.h like it should be.  Instead, CollectorHeap is declared solely in collector.cc.  A forward declaration is present in CollectorHeapIntrospector.h, which is sufficient to use CollectorHeap as a pointer type, but CollectorHeapIntrospector.cpp dereferences CollectorHeaps.  This isn't a problem in the AllInOneFile build because collector.cc, where the struct is currently defined, is included before CollectorHeapIntrospector.  The solution is to move the definition of CollectorHeap into collector.h.

There's also a namespace problem: CollectorHeapIntrospector needs to access something WTF::RemoteMemoryReader, but it does so by calling it RemoteMemoryReader without being in the WTF namespace or providing an appropriate "using" declaration or directive.  Some other source file must have a "using namespace WTF;" that masks the problem in the AllInOneFile build.  When building CollectorHeapIntrospector.cpp as a standalone, RemoteMemoryReader can't be found.  The solution is to fully-qualify RemoteMemoryReader or use a using-declaration or directive.
Comment 1 Mark Mentovai 2008-02-25 14:16:33 PST
Created attachment 19355 [details]
Move the definition of CollectorHeap into collector.h, and provide a "using" declaration for WTF::RemoteMemoryReader
Comment 2 Mark Rowe (bdash) 2008-02-25 14:26:47 PST
Comment on attachment 19355 [details]
Move the definition of CollectorHeap into collector.h, and provide a "using" declaration for WTF::RemoteMemoryReader

The patch looks good to me, but it will need a ChangeLog before it can be landed.  Please see the instructions at <http://webkit.org/coding/contributing.html> and attach an updated patch with a ChangeLog entry for JavaScriptCore.
Comment 3 Mark Mentovai 2008-02-25 14:37:16 PST
Created attachment 19356 [details]
v2, includes ChangeLog entry

Whoops, sorry about that.
Comment 4 Mark Rowe (bdash) 2008-02-25 14:39:24 PST
Comment on attachment 19356 [details]
v2, includes ChangeLog entry

r=me.
Comment 5 Mark Rowe (bdash) 2008-02-25 14:44:50 PST
Landed in r30576.  Thanks for the patch!