[compiler-rt] 89edd1e - tsan: fix warnings in tests
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 08:35:09 PDT 2021
Author: Dmitry Vyukov
Date: 2021-07-28T17:35:02+02:00
New Revision: 89edd1e95f5cc274c0e33cf45ffc85c37b3214f0
URL: https://github.com/llvm/llvm-project/commit/89edd1e95f5cc274c0e33cf45ffc85c37b3214f0
DIFF: https://github.com/llvm/llvm-project/commit/89edd1e95f5cc274c0e33cf45ffc85c37b3214f0.diff
LOG: tsan: fix warnings in tests
Compilers don't like attributes in this position:
warning: GCC does not allow 'noinline' attribute in this position on a function definition
error: attributes are not allowed on a function-definition
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D106951
Added:
Modified:
compiler-rt/test/tsan/ignorelist2.cpp
compiler-rt/test/tsan/longjmp3.cpp
compiler-rt/test/tsan/longjmp4.cpp
compiler-rt/test/tsan/race_on_heap.cpp
compiler-rt/test/tsan/race_top_suppression.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/tsan/ignorelist2.cpp b/compiler-rt/test/tsan/ignorelist2.cpp
index e2e835819b991..f3f636a1263f3 100644
--- a/compiler-rt/test/tsan/ignorelist2.cpp
+++ b/compiler-rt/test/tsan/ignorelist2.cpp
@@ -18,13 +18,13 @@ void *Thread1(void *x) {
return NULL;
}
-void TouchGlobal() __attribute__((noinline)) {
+__attribute__((noinline)) void TouchGlobal() {
// CHECK: Previous write of size 4
// CHECK: #0 TouchGlobal{{.*}}ignorelist2.cpp:[[@LINE+1]]
Global--;
}
-void CallTouchGlobal() __attribute__((noinline)) {
+__attribute__((noinline)) void CallTouchGlobal() {
// CHECK: #1 CallTouchGlobal{{.*}}ignorelist2.cpp:[[@LINE+1]]
TouchGlobal();
}
diff --git a/compiler-rt/test/tsan/longjmp3.cpp b/compiler-rt/test/tsan/longjmp3.cpp
index 3f5dd0333b5e1..db92ec77f56f4 100644
--- a/compiler-rt/test/tsan/longjmp3.cpp
+++ b/compiler-rt/test/tsan/longjmp3.cpp
@@ -17,14 +17,14 @@ void foo(jmp_buf env) {
x++;
}
-void badguy() __attribute__((noinline)) {
+__attribute__((noinline)) void badguy() {
pthread_mutex_t mtx;
pthread_mutex_init(&mtx, 0);
pthread_mutex_lock(&mtx);
pthread_mutex_destroy(&mtx);
}
-void mymain() __attribute__((noinline)) {
+__attribute__((noinline)) void mymain() {
jmp_buf env;
if (setjmp(env) == 42) {
badguy();
diff --git a/compiler-rt/test/tsan/longjmp4.cpp b/compiler-rt/test/tsan/longjmp4.cpp
index 616ee887f0a31..fd31c9c6144a0 100644
--- a/compiler-rt/test/tsan/longjmp4.cpp
+++ b/compiler-rt/test/tsan/longjmp4.cpp
@@ -20,14 +20,14 @@ void foo(jmp_buf env) {
x++;
}
-void badguy() __attribute__((noinline)) {
+__attribute__((noinline)) void badguy() {
pthread_mutex_t mtx;
pthread_mutex_init(&mtx, 0);
pthread_mutex_lock(&mtx);
pthread_mutex_destroy(&mtx);
}
-void mymain() __attribute__((noinline)) {
+__attribute__((noinline)) void mymain() {
jmp_buf env;
if (setjmp(env) == 42) {
badguy();
diff --git a/compiler-rt/test/tsan/race_on_heap.cpp b/compiler-rt/test/tsan/race_on_heap.cpp
index 9a07703a1f8e6..8dd1d260657f5 100644
--- a/compiler-rt/test/tsan/race_on_heap.cpp
+++ b/compiler-rt/test/tsan/race_on_heap.cpp
@@ -14,7 +14,7 @@ void *Thread2(void *p) {
return 0;
}
-void *alloc() __attribute__((noinline)) {
+__attribute__((noinline)) void *alloc() {
return malloc(99);
}
diff --git a/compiler-rt/test/tsan/race_top_suppression.cpp b/compiler-rt/test/tsan/race_top_suppression.cpp
index d1c8f72cefdeb..8e494c1b8b89b 100644
--- a/compiler-rt/test/tsan/race_top_suppression.cpp
+++ b/compiler-rt/test/tsan/race_top_suppression.cpp
@@ -6,7 +6,7 @@
int Global;
-void TopFunction(int *p) __attribute__((noinline)) {
+__attribute__((noinline)) void TopFunction(int *p) {
*p = 1;
}
More information about the llvm-commits
mailing list