This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
It has been an outstanding issue for a long time that some warnings cannot be individually enabled/disabled. The most striking example of this is -Wextra [1]. The warnings emitted by -Wextra are considered, at the same time, questionable or hard to suppress and still useful in some cases. Thus, the ability to individually control each of them is a desirable characteristic frequently requested by users [2].
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7651 [2] http://kerneltrap.org/node/7434
The following patch is a little step towards that goal. It adds a new option -Wempty-body that takes over the function of warning for an empty body occurring in an if or else statement. The new option is enabled by -Wextra, so we keep the current behaviour but add the ability to enable/disable this individual warning.
Bootstrapped and regression tested with --enable-languages=all on i686-pc-linux-gnu.
PR middle-end/7651 * c.opt (Wempty-body): New. * doc/invoke.texi (Wextra) : Document it. * c-opts.c (c_common_post_options): Enabled by -Wextra. * c-common.c (empty_body_warning): Replace Wextra with Wempty-body. * c-parser.c (c_parser_c99_block_statement): Likewise.
testsuite/ 2006-12-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651 * gcc.dg/20001116-1.c : Replace -Wextra with -Wempty-body. * gcc.dg/if-empty-1.c: Likewise. * gcc.dg/pr23165.c: Likewise. * g++.dg/warn/empty-body.C: Likewise.
Attachment:
wempty-body.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |