Skip to content

Commit 6cd7838

Browse files
committed
Header file with tsan definitions.
1 parent 575a57c commit 6cd7838

3 files changed

Lines changed: 42 additions & 13 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* OpDiLib, an Open Multiprocessing Differentiation Library
3+
*
4+
* Copyright (C) 2020-2022 Chair for Scientific Computing (SciComp), TU Kaiserslautern
5+
* Copyright (C) 2023-2025 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
6+
* Homepage: https://scicomp.rptu.de
7+
* Contact: Prof. Nicolas R. Gauger (opdi@scicomp.uni-kl.de)
8+
*
9+
* Lead developer: Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
10+
*
11+
* This file is part of OpDiLib (https://scicomp.rptu.de/software/opdi).
12+
*
13+
* OpDiLib is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
14+
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
15+
* version.
16+
*
17+
* OpDiLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
18+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
19+
* details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License along with OpDiLib. If not, see
22+
* <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
#pragma once
27+
28+
#ifdef __SANITIZE_THREAD__
29+
#define ANNOTATE_RWLOCK_CREATE(lock) AnnotateRWLockCreate(__FILE__, __LINE__, (void*)lock)
30+
#define ANNOTATE_RWLOCK_DESTROY(lock) AnnotateRWLockDestroy(__FILE__, __LINE__, (void*)lock)
31+
#define ANNOTATE_RWLOCK_ACQUIRED(lock, isWrite) AnnotateRWLockAcquired(__FILE__, __LINE__, (void*)lock, isWrite)
32+
#define ANNOTATE_RWLOCK_RELEASED(lock, isWrite) AnnotateRWLockReleased(__FILE__, __LINE__, (void*)lock, isWrite)
33+
34+
extern "C" void AnnotateRWLockCreate(const char* f, int l, void* addr);
35+
extern "C" void AnnotateRWLockDestroy(const char* f, int l, void* addr);
36+
extern "C" void AnnotateRWLockAcquired(const char* f, int l, void* addr, size_t isWrite);
37+
extern "C" void AnnotateRWLockReleased(const char* f, int l, void* addr, size_t isWrite);
38+
#endif

include/opdi/logic/omp/mutexOmpLogic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626
#include <cassert>
2727

28-
#include "../../helpers/macros.hpp"
2928
#include "../../helpers/exceptions.hpp"
29+
#include "../../helpers/macros.hpp"
30+
#include "../../helpers/tsanDefinitions.hpp"
3031
#include "../../config.hpp"
3132
#include "../../tool/toolInterface.hpp"
3233

tests/tests/TestCustomMutex.hpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,9 @@
2525

2626
#pragma once
2727

28-
#include "testBase.hpp"
28+
#include "opdi/helpers/tsanDefinitions.hpp"
2929

30-
#ifdef __SANITIZE_THREAD__
31-
#define ANNOTATE_RWLOCK_CREATE(lock) AnnotateRWLockCreate(__FILE__, __LINE__, (void*)lock)
32-
#define ANNOTATE_RWLOCK_DESTROY(lock) AnnotateRWLockDestroy(__FILE__, __LINE__, (void*)lock)
33-
#define ANNOTATE_RWLOCK_ACQUIRED(lock, isWrite) AnnotateRWLockAcquired(__FILE__, __LINE__, (void*)lock, isWrite)
34-
#define ANNOTATE_RWLOCK_RELEASED(lock, isWrite) AnnotateRWLockReleased(__FILE__, __LINE__, (void*)lock, isWrite)
35-
36-
extern "C" void AnnotateRWLockCreate(const char* f, int l, void* addr);
37-
extern "C" void AnnotateRWLockDestroy(const char* f, int l, void* addr);
38-
extern "C" void AnnotateRWLockAcquired(const char* f, int l, void* addr, size_t isWrite);
39-
extern "C" void AnnotateRWLockReleased(const char* f, int l, void* addr, size_t isWrite);
40-
#endif
30+
#include "testBase.hpp"
4131

4232
template<typename _Case>
4333
struct TestCustomMutex : public TestBase<4, 1, 3, TestCustomMutex<_Case>> {

0 commit comments

Comments
 (0)