Bug 155049
| Summary: | [CMake] Enable -Wsuggest-override | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | achristensen, annulen, darin, mcatanzaro, mrobinson |
| Priority: | P2 | ||
| Version: | Other | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Michael Catanzaro
To help enforce our new coding style, we should enable -Wsuggest-override in WEBKIT_SET_EXTRA_COMPILER_FLAGS:
-Wsuggest-override
Warn about overriding virtual functions that are not marked with
the override keyword.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
However we should investigate if this warning is triggered when using 'final' instead of 'override', as Darin is suggesting that we use 'final' whenever possible [1]. He has some convincing reasons in his follow-up post. If that would trip up -Wsuggest-override then we should probably WONTFIX this.
[1] https://lists.webkit.org/pipermail/webkit-dev/2016-March/028018.html
Darin Adler
We probably want this on for iOS and Mac too.
Michael Catanzaro
Apparently Clang doesn't have this warning, it's GCC-only. :(
Konstantin Tokarev
Clang provides similar -Winconsistent-missing-override, which is included in -Wall. However, it is issued only when class already has at least one method with 'override' specifier.
Konstantin Tokarev
BTW, it looks like -Wsuggest-override is not just GCC-only, but requires GCC 5.1