aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2016-09-19 22:10:11 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2016-09-19 22:10:11 +0000
commit144a96e4c914710cacdb95d33f4e03dc9fed7655 (patch)
treee93888863720e72051a26271bdd350b2c7f07917 /gcc/doc
parent3385d437fe1e17b7ba4735b5b6869e2153bfb506 (diff)
downloadgcc-144a96e4c914710cacdb95d33f4e03dc9fed7655.zip
gcc-144a96e4c914710cacdb95d33f4e03dc9fed7655.tar.gz
gcc-144a96e4c914710cacdb95d33f4e03dc9fed7655.tar.bz2
re PR c++/77434 (warn about suspicious precedence of ternary operator (?:))
gcc: 2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77434 * doc/invoke.texi: Document -Wint-in-bool-context. c-family: 2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77434 * c.opt (Wcond-in-bool-context): New warning. * c-common.c (c_common_truthvalue_conversion): Warn on integer constants in boolean context. cp: 2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77434 * cvt.c (cp_convert_and_check): Suppress Wint-in-bool-context here. testsuite: 2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77434 * c-c++-common/Wint-in-bool-context.c: New test. From-SVN: r240251
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8eb5eff..3c27283 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -273,7 +273,7 @@ Objective-C and Objective-C++ Dialects}.
-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
-Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
--Winit-self -Winline -Wno-int-conversion @gol
+-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
-Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
-Winvalid-pch -Wlarger-than=@var{len} @gol
-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
@@ -3660,6 +3660,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
-Wformat @gol
+-Wint-in-bool-context @gol
-Wimplicit @r{(C and Objective-C only)} @gol
-Wimplicit-int @r{(C and Objective-C only)} @gol
-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
@@ -5837,6 +5838,14 @@ warning about it.
The restrictions on @code{offsetof} may be relaxed in a future version
of the C++ standard.
+@item -Wint-in-bool-context
+@opindex Wint-in-bool-context
+@opindex Wno-int-in-bool-context
+Warn for suspicious use of integer values where boolean values are expected,
+such as conditional expressions (?:) using non-boolean integer constants in
+boolean context, like @code{if (a <= b ? 2 : 3)}.
+This warning is enabled by @option{-Wall}.
+
@item -Wno-int-to-pointer-cast
@opindex Wno-int-to-pointer-cast
@opindex Wint-to-pointer-cast