cvt.c (ocp_convert): Use additional warning sentinel.

/cp
2019-11-20  Paolo Carlini  <paolo.carlini@oracle.com>

	* cvt.c (ocp_convert): Use additional warning sentinel.

/testsuite
2019-11-20  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/warn/multiple-sign-compare-warn-1.C: New.

From-SVN: r278475
This commit is contained in:
Paolo Carlini 2019-11-20 01:02:46 +00:00 committed by Paolo Carlini
parent 56d475cab2
commit 54bf2539c5
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
* cvt.c (ocp_convert): Use additional warning sentinel.
2019-11-19 Jakub Jelinek <jakub@redhat.com> 2019-11-19 Jakub Jelinek <jakub@redhat.com>
PR c++/92414 PR c++/92414

View File

@ -847,6 +847,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
/* Prevent bogus -Wint-in-bool-context warnings coming /* Prevent bogus -Wint-in-bool-context warnings coming
from c_common_truthvalue_conversion down the line. */ from c_common_truthvalue_conversion down the line. */
warning_sentinel w (warn_int_in_bool_context); warning_sentinel w (warn_int_in_bool_context);
warning_sentinel c (warn_sign_compare);
return cp_truthvalue_conversion (e, complain); return cp_truthvalue_conversion (e, complain);
} }
} }

View File

@ -1,3 +1,7 @@
2019-11-20 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/warn/multiple-sign-compare-warn-1.C: New.
2019-11-20 Joseph Myers <joseph@codesourcery.com> 2019-11-20 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-fallthrough-2.c, * gcc.dg/c2x-attr-deprecated-2.c, gcc.dg/c2x-attr-fallthrough-2.c,

View File

@ -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;
}