This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING^5: [PATCH] C/C++: Implement -Wempty-body for do/while, clarify diagnostic
On Sun, 11 Mar 2007, Dirk Mueller wrote:
> * c-common.h (empty_body_warning): Rename to empty_if_body_warning.
> * c-common.c (empty_if_body_warning): Rephrase diagnostic message.
> * c-parser.c (c_parser_if_body): Always add an empty statement in case
> of empty body.
> * c-parser.c (c_parser_do_statement): Warn about empty body in
> do/while statement.
> * c-typeck.c (c_finish_if_stmt): Call empty_if_body_warning.
> * doc/invoke.texi (-Wempty-body): Update documentation.
> * gcc.dg/do-empty.c: New.
> * gcc.dg/if-empty-1.c: Update.
> * gcc.dg/20001116-1.c: Update.
> * gcc.dg/pr23165.c: Update.
OK with changes as noted below:
> - ; /* { dg-warning "warning: empty body in an if-statement" } */
> + ; /* { dg-warning "empty body in an" } */
> - ; /* { dg-warning "warning: empty body in an else-statement" } */
> + ; /* { dg-warning "empty body in an" } */
By removing the initial "warning:" you are losing the assertion that the
diagnostic is a warning not an error. Don't change existing tests that
way until bug 25241 is fixed; instead, update the test text so that it
still includes the initial "warning:".
--
Joseph S. Myers
joseph@codesourcery.com