Skip to content

Commit 2289785

Browse files
committed
[asan] Fix Windows tests
Fix Windows after #101853.
1 parent 862d822 commit 2289785

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,34 @@
1212
#include <malloc.h>
1313
#include <string.h>
1414

15-
extern "C" {
1615
#if defined(EXE)
16+
extern "C" {
1717
__declspec(dllimport) void foo1();
1818
__declspec(dllimport) void foo2();
19+
}
1920

2021
int main() {
2122
foo1();
2223
foo2();
2324
}
2425
#elif defined(DLL1)
26+
extern "C" {
2527
__declspec(dllexport) void foo1() {}
28+
}
2629
#elif defined(DLL2)
27-
__attribute__((noinline))
28-
static void NullDeref(int *ptr) {
30+
extern "C" {
31+
__attribute__((noinline)) static void NullDeref(int *ptr) {
2932
// CHECK: ERROR: AddressSanitizer: access-violation on unknown address
3033
// CHECK: {{0x0*000.. .*pc 0x.*}}
31-
ptr[10]++; // BOOM
34+
ptr[10]++; // BOOM
3235
}
3336

3437
__declspec(dllexport) void foo2() {
35-
NullDeref((int*)0);
38+
NullDeref((int *)0);
3639
// CHECK: {{ #1 0x.* in foo2.*null_deref_multiple_dlls.cpp:}}[[@LINE-1]]
3740
// CHECK: AddressSanitizer can not provide additional info.
3841
}
42+
}
3943
#else
40-
# error oops!
44+
# error oops!
4145
#endif
42-
}

compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <stdio.h>
88
#include <string.h>
99

10-
extern "C" {
1110
#if defined(EXE)
1211
int main(int argc, char **argv) {
1312
if (argc != 2) {
@@ -40,12 +39,13 @@ int main(int argc, char **argv) {
4039
fflush(0);
4140
}
4241
#elif defined(DLL)
42+
extern "C" {
4343
BOOL WINAPI DllMain(HMODULE, DWORD reason, LPVOID) {
4444
printf("in DLL(reason=%d)\n", (int)reason);
4545
fflush(0);
4646
return TRUE;
4747
}
48+
}
4849
#else
4950
# error oops!
5051
#endif
51-
}

compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <stdio.h>
77
#include <string.h>
88

9-
extern "C" {
109
#if defined(EXE)
1110
int main(int argc, char **argv) {
1211
if (argc != 2) {
@@ -36,12 +35,13 @@ int main(int argc, char **argv) {
3635
fflush(0);
3736
}
3837
#elif defined(DLL)
38+
extern "C" {
3939
BOOL WINAPI DllMain(HMODULE, DWORD reason, LPVOID) {
4040
printf("in DLL(reason=%d)\n", (int)reason);
4141
fflush(0);
4242
return TRUE;
4343
}
44+
}
4445
#else
4546
# error oops!
4647
#endif
47-
}

0 commit comments

Comments
 (0)