From: Paolo Carlini Date: Wed, 20 Nov 2019 01:02:46 +0000 (+0000) Subject: cvt.c (ocp_convert): Use additional warning sentinel. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54bf2539c55b886ea60d407a7ef2f56f0a19e861;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d78df6db2b..34af32c9f19 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 bca687fd33b..e67b32ea3b0 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 37fbda183de..0964e44ada5 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 00000000000..39426cd73cf --- /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; +}