From 54bf2539c55b886ea60d407a7ef2f56f0a19e861 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 20 Nov 2019 01:02:46 +0000 Subject: [PATCH] cvt.c (ocp_convert): Use additional warning sentinel. /cp 2019-11-20 Paolo Carlini * cvt.c (ocp_convert): Use additional warning sentinel. /testsuite 2019-11-20 Paolo Carlini * g++.dg/warn/multiple-sign-compare-warn-1.C: New. From-SVN: r278475 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cvt.c | 1 + gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C | 11 +++++++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d78df6..34af32c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2019-11-20 Paolo Carlini + + * cvt.c (ocp_convert): Use additional warning sentinel. + 2019-11-19 Jakub Jelinek PR c++/92414 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index bca687f..e67b32e 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -847,6 +847,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, /* Prevent bogus -Wint-in-bool-context warnings coming from c_common_truthvalue_conversion down the line. */ warning_sentinel w (warn_int_in_bool_context); + warning_sentinel c (warn_sign_compare); return cp_truthvalue_conversion (e, complain); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 37fbda1..0964e44 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-11-20 Paolo Carlini + + * g++.dg/warn/multiple-sign-compare-warn-1.C: New. + 2019-11-20 Joseph Myers * gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-fallthrough-2.c, diff --git a/gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C b/gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C new file mode 100644 index 0000000..39426cd --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C @@ -0,0 +1,11 @@ +// { dg-options "-Wsign-compare" } + +int foo() +{ + unsigned char b = '1'; + + bool x = ~b; // { dg-bogus "promoted bitwise complement of an unsigned value is always nonzero.*promoted bitwise complement of an unsigned value is always nonzero" } + // { dg-warning "promoted bitwise complement of an unsigned value is always nonzero" "" { target *-*-* } .-1 } + + return 0; +} -- 2.7.4