4.6.4.3 W: Enable or Disable Message Option
The -Wmsg
option enables warning and advisory messages. The msg
argument can be the name of a message issued by Clang (e.g. no-implicit-int
) or the number of a message issued by any other compiler application (e.g. 2102
). The special message argument all
indicates that all messages should be enabled. This option has precedence over the -w
option, which disables all warning messages, so it can be used to re-enable selected messages when -w
has been used.
The -Wno-msg
form of the option disables the indicated message, using the same arguments as the enabling form of this option. Where the msg
argument corresponds to a warning or advisory message, this message will never be issued by the compiler or assembler. If the argument corresponds to an error or is not recognized, the compiler will indicate via an error that this operation is not permitted.
main.c:12:1: warning: control reaches end of non-void function [-Wreturn-type]
In the case where -Wno-msg
has been issued and msg
is a number that corresponds to a warning that has been promoted to an error through the -Werror
option, then that message will not be issued by the compiler, nor will any error corresponding to that message.
Where the #pragma warning
has been used in code, it will override at the appropriate time of compilation the actions of the -Wno-msg
and -Werror
options.
If both the -mwarn
and -W[no-]msg
options have been specified, they are processed in the order in which they appear on the command line.