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] | |
Currently, Wextra warns when an expression-statement or the left-hand side of a comma expression contains no side effects. However, as it is currently implemented, the same warning is enabled by -Wunused-value, which in turn is enabled by -Wall.
The following patch removes the warning from Wextra and expands the description of Wunused-value to mention this particular case. It also unifies the code that handles the warning for C and C++ into a single function in c-common.c.
A noteworthy difference between C and C++ implementations is that C++ front-end does not emit the warning for empty statements (IS_EMPTY_STMT). I have favoured the C implementation that does not check for this (since there are instances in the testsuite of such cases while there is no test checking the behaviour of the C++ front-end). Is there any rationale for not emitting the warning for empty statements in C++?
Bootstrapped and regression tested with --enable-languages=all on i686-pc-linux-gnu.
PR middle-end/7651
* doc/invoke.texi (Wunused-value): Update description.
(Wextra): Delete item.
* opts.c (set_Wextra): Don't use the value of Wextra to set the
value of Wunused-value.
* c-typeck.c (c_process_expr_stmt): Don't check extra_warnings.
(c_finish_stmt_expr): Don't check extra_warnings.
(emit_side_effect_warnings): Move function to...
* c-common.c (emit_side_effect_warnings): ... here.
* c-common.h (emit_side_effect_warnings): Declare.cp/ 2007-01-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR middle-end/7651 * cp-gimplify.c (gimplify_expr_stmt): Call emit_side_effect_warnings in c-common.c. Don't check extra_warnings.
Attachment:
wunused-wextra.diff
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |