Bug 155049 - [CMake] Enable -Wsuggest-override
Summary: [CMake] Enable -Wsuggest-override
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-04 14:53 PST by Michael Catanzaro
Modified: 2016-03-06 02:43 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-03-04 14:53:51 PST
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.
Comment 1 Michael Catanzaro 2016-03-04 14:57:23 PST
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
Comment 2 Darin Adler 2016-03-05 12:06:15 PST
We probably want this on for iOS and Mac too.
Comment 3 Michael Catanzaro 2016-03-05 13:26:50 PST
Apparently Clang doesn't have this warning, it's GCC-only. :(
Comment 4 Konstantin Tokarev 2016-03-06 02:31:39 PST
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.
Comment 5 Konstantin Tokarev 2016-03-06 02:43:58 PST
BTW, it looks like -Wsuggest-override is not just GCC-only, but requires GCC 5.1