diff options
author | Dirk Mueller <dmueller@suse.de> | 2007-03-09 16:16:35 +0000 |
---|---|---|
committer | Dirk Mueller <mueller@gcc.gnu.org> | 2007-03-09 16:16:35 +0000 |
commit | 63a0874077b3325c2b3cc47401d8bfe916d8f128 (patch) | |
tree | 0678efcbaa9704baaeb7ec0f167caf43462406c8 /gcc/doc | |
parent | 0de2ae02735c71f5318af4486444d33c26fc211a (diff) | |
download | gcc-63a0874077b3325c2b3cc47401d8bfe916d8f128.zip gcc-63a0874077b3325c2b3cc47401d8bfe916d8f128.tar.gz gcc-63a0874077b3325c2b3cc47401d8bfe916d8f128.tar.bz2 |
re PR c/17946 (wanted: warning for "a && MASK" when "a & MASK" was probably intended)
2007-03-09 Dirk Mueller <dmueller@suse.de>
PR c++/17946
* doc/invoke.texi (-Wlogical-op): Document.
* common.opt (-Wlogical-op): New.
* c-common.h (warn_logical_operator): Declare.
* c-common.c (warn_logical_operator): Define.
* c-typeck.c (parser_build_binary_op): Call
warn_logical_operator.
* cp/call.c (build_new_op): Call warn_logical_operator.
* testsuite/gcc.dg/Wlogical-op-1.c: New.
* testsuite/g++.dg/warn/Wlogical-op-1.C: New.
From-SVN: r122751
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6ecde2e..9879884 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -236,9 +236,9 @@ Objective-C and Objective-C++ Dialects}. -Wformat-security -Wformat-y2k @gol -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol -Wimport -Wno-import -Winit-self -Winline @gol --Wno-int-to-pointer-cast @gol --Wno-invalid-offsetof -Winvalid-pch @gol --Wlarger-than-@var{len} -Wunsafe-loop-optimizations -Wlong-long @gol +-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol +-Winvalid-pch -Wlarger-than-@var{len} -Wunsafe-loop-optimizations @gol +-Wlogical-op -Wlong-long @gol -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol @@ -3420,6 +3420,13 @@ behavior and are not portable in C, so they usually indicate that the programmer intended to use @code{strcmp}. This warning is enabled by @option{-Wall}. +@item -Wlogical-op +@opindex Wlogical-op +@opindex Wno-logical-op +Warn about suspicious uses of logical operators in expressions. +This includes using logical operators in contexts where a +bit-wise operator is likely to be expected. + @item -Waggregate-return @opindex Waggregate-return Warn if any functions that return structures or unions are defined or |