OSDN Git Service

2012-06-04 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jun 2012 20:30:59 +0000 (20:30 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Jun 2012 20:30:59 +0000 (20:30 +0000)
PR c++/53524
* doc/invoke.texi (Wenum-compare): Update documentation.

/cp
2012-06-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53524
* call.c (build_conditional_expr_1): Use OPT_Wenum_compare
to control enumeral mismatch in conditional expression too.

/testsuite
2012-06-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53524
* g++.dg/warn/Wenum-compare-no-2: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@188207 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wenum-compare-no-2.C [new file with mode: 0644]

index aac5229..ac85b92 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53524
+       * doc/invoke.texi (Wenum-compare): Update documentation.
+
 2012-06-04  Edmar Wienskoski  <edmar@freescale.com>
 
        PR target/53559
 2012-06-04  Edmar Wienskoski  <edmar@freescale.com>
 
        PR target/53559
@@ -23,7 +28,7 @@
 
        Backport from mainline
        2012-04-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
        2012-04-25  Jakub Jelinek  <jakub@redhat.com>
+
        PR middle-end/52979
        * stor-layout.c (get_best_mode): Don't return mode with bitsize
        larger than maxbits.  Don't compute maxbits modulo align.
        PR middle-end/52979
        * stor-layout.c (get_best_mode): Don't return mode with bitsize
        larger than maxbits.  Don't compute maxbits modulo align.
index fed7728..44d2e1b 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53524
+       * call.c (build_conditional_expr_1): Use OPT_Wenum_compare
+       to control enumeral mismatch in conditional expression too.
+
 2012-06-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/52973
 2012-06-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/52973
index 2499ad1..5e74f56 100644 (file)
@@ -4630,7 +4630,7 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3,
          && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
         {
           if (complain & tf_warning)
          && TREE_CODE (arg3_type) == ENUMERAL_TYPE)
         {
           if (complain & tf_warning)
-            warning (0
+            warning (OPT_Wenum_compare
                      "enumeral mismatch in conditional expression: %qT vs %qT",
                      arg2_type, arg3_type);
         }
                      "enumeral mismatch in conditional expression: %qT vs %qT",
                      arg2_type, arg3_type);
         }
index 2c77906..f752a66 100644 (file)
@@ -4213,9 +4213,10 @@ while} statement.  This warning is also enabled by @option{-Wextra}.
 @item -Wenum-compare
 @opindex Wenum-compare
 @opindex Wno-enum-compare
 @item -Wenum-compare
 @opindex Wenum-compare
 @opindex Wno-enum-compare
-Warn about a comparison between values of different enumerated types. In C++
-this warning is enabled by default.  In C this warning is enabled by
-@option{-Wall}.
+Warn about a comparison between values of different enumerated types.
+In C++ enumeral mismatches in conditional expressions are also
+diagnosed and the warning is enabled by default.  In C this warning is 
+enabled by @option{-Wall}.
 
 @item -Wjump-misses-init @r{(C, Objective-C only)}
 @opindex Wjump-misses-init
 
 @item -Wjump-misses-init @r{(C, Objective-C only)}
 @opindex Wjump-misses-init
index c829204..b7c373f 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53524
+       * g++.dg/warn/Wenum-compare-no-2: New.
+
 2012-06-04  Edmar Wienskoski  <edmar@freescale.com>
 
        PR target/53559
 2012-06-04  Edmar Wienskoski  <edmar@freescale.com>
 
        PR target/53559
@@ -14,7 +19,7 @@
 
        Backport from mainline
        2012-04-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
        2012-04-25  Jakub Jelinek  <jakub@redhat.com>
+
        PR middle-end/52979
        * gcc.c-torture/compile/pr52979-1.c: New test.
        * gcc.c-torture/execute/pr52979-1.c: New test.
        PR middle-end/52979
        * gcc.c-torture/compile/pr52979-1.c: New test.
        * gcc.c-torture/execute/pr52979-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/warn/Wenum-compare-no-2.C b/gcc/testsuite/g++.dg/warn/Wenum-compare-no-2.C
new file mode 100644 (file)
index 0000000..fa7dda8
--- /dev/null
@@ -0,0 +1,31 @@
+// PR c++/53524
+// { dg-options "-Wno-enum-compare" }
+
+template < typename > struct PointerLikeTypeTraits {
+  enum { NumLowBitsAvailable };
+};
+
+class CodeGenInstruction;
+class CodeGenInstAlias;
+
+template < typename T>
+struct PointerIntPair {
+  enum { IntShift = T::NumLowBitsAvailable };
+};
+
+template < typename PT1, typename PT2 > struct PointerUnionUIntTraits {
+  enum {
+    PT1BitsAv = PointerLikeTypeTraits < PT1 >::NumLowBitsAvailable,
+    PT2BitsAv = PointerLikeTypeTraits < PT2 >::NumLowBitsAvailable,
+    NumLowBitsAvailable = 0 ? PT1BitsAv : PT2BitsAv
+  };
+};
+
+template < typename PT1, typename PT2 > class PointerUnion {
+  typedef PointerIntPair < PointerUnionUIntTraits < PT1, PT2 > > ValTy;
+  ValTy Val;
+};
+
+struct ClassInfo {
+  PointerUnion < CodeGenInstruction *, CodeGenInstAlias * > DefRec;
+};