Reputation:
What is the meaning of -Wextra
in clang compiler flag?
I was curious what does all the flags such as -Wall
, -Werror
means. I was able to find answers for others, but not -Wextra
.
clang -Wall -Wextra -Werror
Upvotes: 0
Views: 1800
Reputation: 9366
-Wextra
compiler flag is not just in clang but also in gcc. According to the gcc docs:
This enables some extra warning flags that are not enabled by
-Wall
. This option used to be called-W
. The older name is still supported, but the newer name is more descriptive.
Source:
Upvotes: 2
Reputation: 1907
-Wextra
flag is not specific to just the clang compiler, it is documented in the GCC Compiler as well. Basically, -Wall
enables all (common) warning flags but this excludes many flags.
Some of these, notably -Wempty-init-stmt
, -Wignored-qualifiers
, -Winitializer-overrides
, -Wmissing-field-initializers
, -Wmissing-method-return-type
, -Wnull-pointer-arithmetic
, -Wsemicolon-before-method-body
, -Wsign-compare
, -Wunused-parameter
are covered by -Wextra
instead.
You can find out more about what each of these mean in the documentation.
Upvotes: 3