Bug 57241

Summary: check-webkit-style: "using namespace foo;" should be flagged as an error in headers
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: brian.holt, commit-queue, dpranke, glenn, levin, mrobinson, rniwa, skyul
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

David Kilzer (:ddkilzer)
Reported 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.
Attachments
Patch (4.14 KB, patch)
2013-07-16 04:38 PDT, Brian Holt
no flags
David Levin
Comment 1 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.
Brian Holt
Comment 2 2013-07-16 04:38:50 PDT
WebKit Commit Bot
Comment 3 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>
WebKit Commit Bot
Comment 4 2013-07-16 06:04:28 PDT
All reviewed patches have been landed. Closing bug.
Kwang Yul Seo
Comment 5 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]
Kwang Yul Seo
Comment 6 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.
Note You need to log in before you can comment on or make changes to this bug.