Hi developers,
The Apple EWS bots have long used -Werror to make warnings fatal,
discouraging inadvertently introducing new build warnings. But CMake
EWS bots did not, until now. The new CMake behavior after
https://commits.webkit.org/255961@main is:
* By default, warnings are not fatal.
* Warnings become fatal if you use the -DDEVELOPER_MODE=ON CMake flag.
The build-webkit script always enables this.
* An off switch exists, -DDEVELOPER_MODE_FATAL_WARNINGS=OFF, with a
corresponding --no-fatal-warnings flag for build-webkit. Use this
whenever you're bisecting, or when you're in a hurry and don't have
time to deal with particular warnings.
* All post-commit bots now build with --no-fatal-warnings to avoid
losing test results to a compiler warning. The EWS does not, to
discourage introduction of new warnings.
Some common warnings to avoid:
* -Wreturn-type is by far the most common GCC warning introduced into
WebKit. This occurs when you expect a switch statement to always
return, but forget to ensure that it really does when passed an invalid
enum value. Clang does not complain about these, so only the bots using
GCC will notice it. The normal solution is to add
RELEASE_ASSERT_NOT_REACHED() to the bottom of the function. In
especially hot functions, that might have performance impact, and you
might need to write the code in an alternative way or use
IGNORE_RETURN_TYPE_WARNINGS_BEGIN/END from Compiler.h. (I've considered
disabling this warning due to how frequently we introduce code that
trips it, but have left it because returning bogus data is very bad.)
* -Wunused-parameter and -Wunused-variable warnings often occur around
ENABLE() or USE() build guards. Use UNUSED_PARAM() and
UNUSED_VARIABLE(), respectively, to suppress these. Note that
Source/WebKit builds with -Wno-unused-parameter, but most of the rest
of WebKit does not.
* -Wredundant-move occurs when you write "return WTFMove(foo)" and the
solution is to remove the WTFMove(). Clang only warns when the move
blocks return value optimization, but GCC warns always.
Of course there are plenty more warnings you might encounter, but those
are the most common ones. If you find something you don't know how to
deal with, don't hesitate to ask for help. False positives can be
suppressed using IGNORE_WARNINGS_BEGIN() and IGNORE_WARNINGS_END() or
one of the similar macros from Compiler.h.
I believe the --no-fatal-warnings flag is not currently hooked up to
anything on Apple ports. This would be good to improve.
Michael
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev