Manuel LÃpez-IbÃÃez - Wunused-value and Wextra interaction (PR7651 Define -Wextra strictly in (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

Wunused-value and Wextra interaction (PR7651 Define -Wextra strictly in terms of other warning flags)


:ADDPATCH c++:This patch continues the effort to fix PR7651 [1].

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.

OK for mainline?[1] http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01103.html2007-01-05 Manuel Lopez-Ibanez manu@gcc.gnu.org

PR middle-end/7651

cp/ 2007-01-05 Manuel Lopez-Ibanez manu@gcc.gnu.org

PR middle-end/7651

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]