Skip to content

Commit 3f5d56a

Browse files
authored
Merge pull request #33264 from JuliaLang/vc/nfc
move sanitizer related functionality out of public header
2 parents 77fa781 + 7c53b37 commit 3f5d56a

File tree

3 files changed

+22
-30
lines changed

3 files changed

+22
-30
lines changed

src/julia.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,6 @@
6565
# define JL_THREAD_LOCAL
6666
#endif
6767

68-
#if defined(__has_feature)
69-
#if __has_feature(address_sanitizer)
70-
#define JL_ASAN_ENABLED // Clang flavor
71-
#endif
72-
#elif defined(__SANITIZE_ADDRESS__)
73-
#define JL_ASAN_ENABLED // GCC flavor
74-
#endif
75-
76-
#ifdef JL_ASAN_ENABLED
77-
78-
#ifdef __cplusplus
79-
extern "C" {
80-
#endif
81-
void __sanitizer_start_switch_fiber(void**, const void*, size_t);
82-
void __sanitizer_finish_switch_fiber(void*, const void**, size_t*);
83-
#ifdef __cplusplus
84-
}
85-
#endif
86-
87-
static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {
88-
__sanitizer_start_switch_fiber(NULL, bottom, size);
89-
}
90-
static inline void sanitizer_finish_switch_fiber() {
91-
__sanitizer_finish_switch_fiber(NULL, NULL, NULL);
92-
}
93-
#else
94-
static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {}
95-
static inline void sanitizer_finish_switch_fiber() {}
96-
#endif
97-
9868
#define container_of(ptr, type, member) \
9969
((type *) ((char *)(ptr) - offsetof(type, member)))
10070

src/julia_internal.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
#define JL_ASAN_ENABLED // GCC flavor
2222
#endif
2323

24+
#ifdef JL_ASAN_ENABLED
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
void __sanitizer_start_switch_fiber(void**, const void*, size_t);
29+
void __sanitizer_finish_switch_fiber(void*, const void**, size_t*);
30+
#ifdef __cplusplus
31+
}
32+
#endif
33+
#endif
2434

2535
#if defined(__has_feature)
2636
#if __has_feature(memory_sanitizer)

src/task.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
extern "C" {
4141
#endif
4242

43+
#ifdef JL_ASAN_ENABLED
44+
static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {
45+
__sanitizer_start_switch_fiber(NULL, bottom, size);
46+
}
47+
static inline void sanitizer_finish_switch_fiber(void) {
48+
__sanitizer_finish_switch_fiber(NULL, NULL, NULL);
49+
}
50+
#else
51+
static inline void sanitizer_start_switch_fiber(const void* bottom, size_t size) {}
52+
static inline void sanitizer_finish_switch_fiber(void) {}
53+
#endif
54+
4355
#if defined(_OS_WINDOWS_)
4456
volatile int jl_in_stackwalk = 0;
4557
#else

0 commit comments

Comments
 (0)