Bug 57239 - Use forward class declaration instead of including header
Summary: Use forward class declaration instead of including header
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-03-28 09:26 PDT by David Kilzer (:ddkilzer)
Modified: 2011-03-28 10:41 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.55 KB, patch)
2011-03-28 09:26 PDT, David Kilzer (:ddkilzer)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2011-03-28 09:26:43 PDT
Created attachment 87153 [details]
Patch

Reviewed by NOBODY (OOPS!).

Adding a "using namespace WebCore;" statement in a header may
cause issues when <WebCore/Length.h> is included before
<CoreText/CoreText.h>.

Length.h defines the LengthType enum with a 'Fixed' value.
CoreText.h includes MacTypes.h, which has a
"typedef SInt32 Fixed;" statement, and then CoreText.h includes
other headers that also use 'Fixed', but expect the typedef to
be defined, not the enum.  If another header includes
"using namespace WebCore;" before CoreText.h, the
following compiler errors result (paths abbreviated):

CoreText.framework/Headers/SFNTLayoutTypes.h:689: error: reference to 'Fixed' is ambiguous
MacTypes.h:184: error: candidates are: typedef SInt32 Fixed
Length.h:37: error:                 WebCore::LengthType WebCore::Fixed
SFNTLayoutTypes.h:689: error: 'Fixed' does not name a type

* platform/mac/HTMLConverter.h: Use forward declaration of
DocumentLoader class instead of including header.  Remove the
unused "using namespace WebCore;" statement.
---
 2 files changed, 31 insertions(+), 3 deletions(-)
Comment 1 WebKit Review Bot 2011-03-28 09:29:46 PDT
Attachment 87153 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 2 David Kilzer (:ddkilzer) 2011-03-28 09:42:04 PDT
I filed Bug 57241 about check-webkit-style flagging "using namespace Foo;" statements in headers.
Comment 3 David Kilzer (:ddkilzer) 2011-03-28 09:42:26 PDT
<rdar://problem/9192997>
Comment 4 David Kilzer (:ddkilzer) 2011-03-28 09:55:36 PDT
(In reply to comment #1)
> Attachment 87153 [details] did not pass style-queue:
> 
> Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
> 
> Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
> Total errors found: 1 in 2 files
> 
> If any of these errors are false positives, please file a bug against check-webkit-style.

I want webkit-patch to support a placeholder for the bug number.  I filed:  Bug 57242.
Comment 5 David Kilzer (:ddkilzer) 2011-03-28 10:08:27 PDT
Committed r82128: <http://trac.webkit.org/changeset/82128>
Comment 6 WebKit Review Bot 2011-03-28 10:41:47 PDT
http://trac.webkit.org/changeset/82128 might have broken Leopard Intel Debug (Tests)