[libcxxabi] r272821 - [libcxxabi] Reorder base class initializers in libc++abi tests to prevent -Wreorder

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 12:33:02 PDT 2016


Author: ericwf
Date: Wed Jun 15 14:33:01 2016
New Revision: 272821

URL: http://llvm.org/viewvc/llvm-project?rev=272821&view=rev
Log:
[libcxxabi] Reorder base class initializers in libc++abi tests to prevent -Wreorder

Summary:
This patch fixes -Wreorder warnings on test classes with virtual bases. Since the compiler is performing the reordering anyway this change *should* have NFC.

However the test notes that it is checking that "virtual base classes work properly". Since initialization order is clearly part of correctness I want to confirm that this wasn't an intentional mistake.



Reviewers: mclow.lists, howard.hinnant

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21396

Modified:
    libcxxabi/trunk/test/catch_class_04.pass.cpp
    libcxxabi/trunk/test/catch_ptr.pass.cpp

Modified: libcxxabi/trunk/test/catch_class_04.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_class_04.pass.cpp?rev=272821&r1=272820&r2=272821&view=diff
==============================================================================
--- libcxxabi/trunk/test/catch_class_04.pass.cpp (original)
+++ libcxxabi/trunk/test/catch_class_04.pass.cpp Wed Jun 15 14:33:01 2016
@@ -66,8 +66,8 @@ struct A
 {
     static int count;
     int id_;
-    explicit A(int id) : C1(id-1), C2(id-2), B(id+3), id_(id) {count++;}
-    A(const A& a) : C1(a.id_-1), C2(a.id_-2), B(a.id_+3), id_(a.id_) {count++;}
+    explicit A(int id) : B(id+3), C1(id-1), C2(id-2), id_(id) {count++;}
+    A(const A& a) :  B(a.id_+3), C1(a.id_-1), C2(a.id_-2), id_(a.id_) {count++;}
     ~A() {count--;}
 };
 

Modified: libcxxabi/trunk/test/catch_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_ptr.pass.cpp?rev=272821&r1=272820&r2=272821&view=diff
==============================================================================
--- libcxxabi/trunk/test/catch_ptr.pass.cpp (original)
+++ libcxxabi/trunk/test/catch_ptr.pass.cpp Wed Jun 15 14:33:01 2016
@@ -66,8 +66,8 @@ struct A
 {
     static int count;
     int id_;
-    explicit A(int id) : C1(id-1), C2(id-2), B(id+3), id_(id) {count++;}
-    A(const A& a) : C1(a.id_-1), C2(a.id_-2), B(a.id_+3), id_(a.id_) {count++;}
+    explicit A(int id) : B(id+3), C1(id-1), C2(id-2), id_(id) {count++;}
+    A(const A& a) : B(a.id_+3), C1(a.id_-1), C2(a.id_-2),  id_(a.id_) {count++;}
     ~A() {count--;}
 };
 




More information about the cfe-commits mailing list