Skip to content

Commit 6f2358e

Browse files
committed
[compiler-rt][asan] Silence MSVC warning
Disable `warning C4200: nonstandard extension used : zero-sized array in struct/union` as done in other places in compiler-rt.
1 parent 2385cf6 commit 6f2358e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler-rt/lib/asan/asan_thread.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ class AsanThreadContext final : public ThreadContextBase {
5656
// AsanThreadContext objects are never freed, so we need many of them.
5757
COMPILER_CHECK(sizeof(AsanThreadContext) <= 256);
5858

59+
#if defined(_MSC_VER) && !defined(__clang__)
60+
// MSVC raises a warning about a nonstandard extension being used for the 0
61+
// sized element in this array. Disable this for warn-as-error builds.
62+
# pragma warning(push)
63+
# pragma warning(disable : 4200)
64+
#endif
65+
5966
// AsanThread are stored in TSD and destroyed when the thread dies.
6067
class AsanThread {
6168
public:
@@ -185,6 +192,10 @@ class AsanThread {
185192
char start_data_[];
186193
};
187194

195+
#if defined(_MSC_VER) && !defined(__clang__)
196+
# pragma warning(pop)
197+
#endif
198+
188199
// Returns a single instance of registry.
189200
ThreadRegistry &asanThreadRegistry();
190201
ThreadArgRetval &asanThreadArgRetval();

0 commit comments

Comments
 (0)