Bug 57241 - check-webkit-style: "using namespace foo;" should be flagged as an error in headers
Summary: check-webkit-style: "using namespace foo;" should be flagged as an error in h...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 09:38 PDT by David Kilzer (:ddkilzer)
Modified: 2013-07-16 16:51 PDT (History)
8 users (show)

See Also:


Attachments
Patch (4.14 KB, patch)
2013-07-16 04:38 PDT, Brian Holt
no flags 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:38:45 PDT
In Bug 57239, a "using namespace WebCore;" statement caused issues when compiling WebCore on iOS (even though the body of HTMLConverter.mm was commented out).  Such "using namespace" statements are very dangerous in headers, so check-webkit-style should flag them as an error.

I'm told that llvm (clang) may warn about "using namespace" statements in headers in the future, but since not all ports will be using llvm to compile WebKit, it would still be good to have this in check-webkit-style.
Comment 1 David Levin 2011-03-29 10:22:19 PDT
fwiw, the code is here: http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

And I'm willing to give pointers (and reviews) to anyone who wants to add checks.
Comment 2 Brian Holt 2013-07-16 04:38:50 PDT
Created attachment 206762 [details]
Patch
Comment 3 WebKit Commit Bot 2013-07-16 06:04:23 PDT
Comment on attachment 206762 [details]
Patch

Clearing flags on attachment: 206762

Committed r152719: <http://trac.webkit.org/changeset/152719>
Comment 4 WebKit Commit Bot 2013-07-16 06:04:28 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Kwang Yul Seo 2013-07-16 16:28:44 PDT
This patch is buggy. It seems check-webkit-style checks "using namespace" statements not only in headers but also in cpp files too.

See https://bugs.webkit.org/show_bug.cgi?id=110136#c14
Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp:45:  Do not use 'using namespace WebCore;'.  [build/using_namespace] [4]
Comment 6 Kwang Yul Seo 2013-07-16 16:51:47 PDT
(In reply to comment #5)
> This patch is buggy. It seems check-webkit-style checks "using namespace" statements not only in headers but also in cpp files too.
> 
> See https://bugs.webkit.org/show_bug.cgi?id=110136#c14
> Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp:45:  Do not use 'using namespace WebCore;'.  [build/using_namespace] [4]

I filed Bug 118755 to fix this.