c-common.c (c_common_truthvalue_conversion): Generalise warning for addresses convert...
authorBen Elliston <bje@au.ibm.com>
Tue, 13 Dec 2005 23:33:26 +0000 (23:33 +0000)
committerBen Elliston <bje@gcc.gnu.org>
Tue, 13 Dec 2005 23:33:26 +0000 (10:33 +1100)
commit690a704a4e5eda3745d4b0d650cba90a36702a64
treed72ae86b6320671af20df2fd5c12deb106455c3a
parent383eca9ccea8275baab7d6bdf5f464e113482dec
c-common.c (c_common_truthvalue_conversion): Generalise warning for addresses converted to booleans; not just function addresses.

* c-common.c (c_common_truthvalue_conversion): Generalise warning
for addresses converted to booleans; not just function addresses.
* c-typeck.c (build_binary_op): Warn for address comparisons which
can never be NULL (eg. func == NULL or &var == NULL).
* common.opt (Walways-true): New option.
* c-opts.c (c_common_handle_option): Set it with -Wall.
* doc/invoke.texi: Document it.
testsuite/
* gcc.dg/warn-addr-cmp.c: New test.

From-SVN: r108489
gcc/ChangeLog
gcc/c-common.c
gcc/c-opts.c
gcc/c-typeck.c
gcc/common.opt
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/warn-addr-cmp.c [new file with mode: 0644]