[compiler-rt] r357524 - [NFC] Test is C++, not C
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 13:39:10 PDT 2019
Author: yln
Date: Tue Apr 2 13:39:10 2019
New Revision: 357524
URL: http://llvm.org/viewvc/llvm-project?rev=357524&view=rev
Log:
[NFC] Test is C++, not C
Added:
compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.cc
Removed:
compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.c
Removed: compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.c?rev=357523&view=auto
==============================================================================
--- compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.c (original)
+++ compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.c (removed)
@@ -1,43 +0,0 @@
-// RUN: %clangxx_tsan %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s
-
-#include <dispatch/dispatch.h>
-
-#import <memory>
-#import <stdatomic.h>
-
-_Atomic(long) destructor_counter = 0;
-
-struct MyStruct {
- virtual ~MyStruct() {
- usleep(10000);
- atomic_fetch_add_explicit(&destructor_counter, 1, memory_order_relaxed);
- }
-};
-
-int main(int argc, const char *argv[]) {
- fprintf(stderr, "Hello world.\n");
-
- dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- dispatch_group_t g = dispatch_group_create();
-
- for (int i = 0; i < 100; i++) {
- std::shared_ptr<MyStruct> shared(new MyStruct());
-
- dispatch_group_async(g, q, ^{
- shared.get(); // just to make sure the object is captured by the block
- });
- }
-
- dispatch_group_wait(g, DISPATCH_TIME_FOREVER);
-
- if (destructor_counter != 100) {
- abort();
- }
-
- fprintf(stderr, "Done.\n");
-}
-
-// CHECK: Hello world.
-// CHECK-NOT: WARNING: ThreadSanitizer
-// CHECK: Done.
Added: compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.cc?rev=357524&view=auto
==============================================================================
--- compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.cc (added)
+++ compiler-rt/trunk/test/tsan/libdispatch/groups-destructor.cc Tue Apr 2 13:39:10 2019
@@ -0,0 +1,43 @@
+// RUN: %clangxx_tsan %s -o %t
+// RUN: %run %t 2>&1 | FileCheck %s
+
+#include <dispatch/dispatch.h>
+
+#import <memory>
+#import <stdatomic.h>
+
+_Atomic(long) destructor_counter = 0;
+
+struct MyStruct {
+ virtual ~MyStruct() {
+ usleep(10000);
+ atomic_fetch_add_explicit(&destructor_counter, 1, memory_order_relaxed);
+ }
+};
+
+int main(int argc, const char *argv[]) {
+ fprintf(stderr, "Hello world.\n");
+
+ dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+ dispatch_group_t g = dispatch_group_create();
+
+ for (int i = 0; i < 100; i++) {
+ std::shared_ptr<MyStruct> shared(new MyStruct());
+
+ dispatch_group_async(g, q, ^{
+ shared.get(); // just to make sure the object is captured by the block
+ });
+ }
+
+ dispatch_group_wait(g, DISPATCH_TIME_FOREVER);
+
+ if (destructor_counter != 100) {
+ abort();
+ }
+
+ fprintf(stderr, "Done.\n");
+}
+
+// CHECK: Hello world.
+// CHECK-NOT: WARNING: ThreadSanitizer
+// CHECK: Done.
More information about the llvm-commits
mailing list