Summary: | check-webkit-style: fix false-positive warnings about using #pragma once header guard | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Megan Gardner <megan_gardner> | ||||
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | beidson, commit-queue, glenn, joepeck, lforschler, simon.fraser | ||||
Priority: | P2 | ||||||
Version: | Other | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Megan Gardner
2016-10-17 17:41:40 PDT
Ooo good point... I wonder if we can tell if such a file will be ObjC/ObjC++. We could employ heuristics like "if there is an #import". I think the simple solution is to detect *if* there is a header guard, *then* it has to be pragma once. Headers without guards are clearly okay (as if they weren't okay then the builds would be failing) > Headers without guards are clearly okay (as if they weren't okay then the
> builds would be failing)
It would be nice to detect and warn when a header is missing header guards that _should_ have header guards. A build may succeed if its missing, but later when someone else double includes the header it could fail.
That said, your suggestion should catch the majority of cases. Patch coming.
Created attachment 292084 [details]
[PATCH] Proposed Fix
(In reply to comment #3) > > Headers without guards are clearly okay (as if they weren't okay then the > > builds would be failing) > > It would be nice to detect and warn when a header is missing header guards > that _should_ have header guards. A build may succeed if its missing, but > later when someone else double includes the header it could fail. Yah, I guess that was the unspoken subtext of what I meant. I also am not sure what the actual compiler error is when you double include a header - Whether it's unintelligible random errors, or if the compiler explicitly points it out. In the later case, I think it'd be fine to just ignore it until an error pops up. Comment on attachment 292084 [details]
[PATCH] Proposed Fix
lgtm
Comment on attachment 292084 [details] [PATCH] Proposed Fix Clearing flags on attachment: 292084 Committed r207559: <http://trac.webkit.org/changeset/207559> All reviewed patches have been landed. Closing bug. |