diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2016-09-21 20:14:44 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2016-09-21 20:14:44 +0000 |
commit | a09e9e35a62b19065ba248f666cf87364ee68a1c (patch) | |
tree | 6e456e9091f639e4339d0df9d4f7ac98a9aa3582 /gcc/c-family/c-common.c | |
parent | 63cb3926080e7f7e1b93dd94911ad4720813a081 (diff) | |
download | gcc-a09e9e35a62b19065ba248f666cf87364ee68a1c.zip gcc-a09e9e35a62b19065ba248f666cf87364ee68a1c.tar.gz gcc-a09e9e35a62b19065ba248f666cf87364ee68a1c.tar.bz2 |
c-common.c (c_common_truthvalue_conversion): Inhibit Wint-in-bool-context warning with from_macro_definition_at.
2016-09-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-common.c (c_common_truthvalue_conversion): Inhibit
Wint-in-bool-context warning with from_macro_definition_at.
Mention the expression will always evaluate to true.
From-SVN: r240331
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r-- | gcc/c-family/c-common.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index d1372a4..48d8b05 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -4652,7 +4652,8 @@ c_common_truthvalue_conversion (location_t location, tree expr) TREE_OPERAND (expr, 0)); case COND_EXPR: - if (warn_int_in_bool_context) + if (warn_int_in_bool_context + && !from_macro_definition_at (EXPR_LOCATION (expr))) { tree val1 = fold_for_warn (TREE_OPERAND (expr, 1)); tree val2 = fold_for_warn (TREE_OPERAND (expr, 2)); @@ -4663,7 +4664,8 @@ c_common_truthvalue_conversion (location_t location, tree expr) && (!integer_onep (val1) || !integer_onep (val2))) warning_at (EXPR_LOCATION (expr), OPT_Wint_in_bool_context, - "?: using integer constants in boolean context"); + "?: using integer constants in boolean context, " + "the expression will always evaluate to %<true%>"); } /* Distribute the conversion into the arms of a COND_EXPR. */ if (c_dialect_cxx ()) |