NEW 155049
[CMake] Enable -Wsuggest-override
https://bugs.webkit.org/show_bug.cgi?id=155049
Summary [CMake] Enable -Wsuggest-override
Michael Catanzaro
Reported 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.
Attachments
Michael Catanzaro
Comment 1 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
Darin Adler
Comment 2 2016-03-05 12:06:15 PST
We probably want this on for iOS and Mac too.
Michael Catanzaro
Comment 3 2016-03-05 13:26:50 PST
Apparently Clang doesn't have this warning, it's GCC-only. :(
Konstantin Tokarev
Comment 4 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.
Konstantin Tokarev
Comment 5 2016-03-06 02:43:58 PST
BTW, it looks like -Wsuggest-override is not just GCC-only, but requires GCC 5.1
Note You need to log in before you can comment on or make changes to this bug.