cvt.c (ocp_convert): Use additional warning sentinel.
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 20 Nov 2019 01:02:46 +0000 (01:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 20 Nov 2019 01:02:46 +0000 (01:02 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/multiple-sign-compare-warn-1.C [new file with mode: 0644]

index 0d78df6db2b853ffd62ea64960b05f0250e3ab7c..34af32c9f194e42dab616c889aee6e01682dcfd8 100644 (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>
 
        PR c++/92414
index bca687fd33b58a4d80f82f16bc5bd1a67488b891..e67b32ea3b0de6fd6b6f7894d1184636c96116f2 100644 (file)
@@ -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);
            }
        }
index 37fbda183dec458e99c663ae8884d89c530bcdc7..0964e44ada59187dcc395efc8e9a7ff940e4e2c2 100644 (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>
 
        * 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 (file)
index 0000000..39426cd
--- /dev/null
@@ -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;
+}