Search code examples
c++gcc

-Wextra-semi is not supported in gcc?


According to https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html -Wextra-semi is a valid flag. However, for me even gcc-7.2.0 does not seem to recognize it as a valid option:

[bash]$ g++ -Wextra-semi test.cpp
g++: error: unrecognized command line option ‘-Wextra-semi’; did you mean ‘-Wextra’?
[bash]$ g++ --version | head -1
g++ (GCC) 7.2.0
[bash]$ g++ -Q --help=warnings | grep "extra"
   --extra-warnings                 
   -Wconversion-extra               [disabled]
   -Wextra                          [disabled]
   -Wformat-extra-args              [disabled]

Any ideas why? Does it have to be to enabled somehow?


Solution

  • Using the index at https://gcc.gnu.org/onlinedocs/ you can find the documentation for 7.2, which doesn't contain -Wextra-semi.

    At the bottom of the index page, under the "Current development" header, is the link to the version of the documentation that you were looking at. Pay particular attention to the note:

    Please note that the following documentation refers to current development. Some information may not be applicable to any existing release.

    You are reading the documentation for a release that doesn't exist yet. The option will probably work in the next release (this is not a guarantee; if the new feature doesn't work out it can be removed before release).