This is the mail archive of the 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]

PR7651 Define -Wextra strictly in terms of other warning flags

:ADDPATCH middle-end:

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].


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

OK for mainline?

2006-12-15 Manuel Lopez-Ibanez <>

 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 <>

 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]