[compiler-rt] 6f2358e - [compiler-rt][asan] Silence MSVC warning
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 09:29:43 PDT 2023
Author: Alexandre Ganea
Date: 2023-10-02T12:29:29-04:00
New Revision: 6f2358ee7750b0e8e7b457b82c4ab81ca78d1950
URL: https://github.com/llvm/llvm-project/commit/6f2358ee7750b0e8e7b457b82c4ab81ca78d1950
DIFF: https://github.com/llvm/llvm-project/commit/6f2358ee7750b0e8e7b457b82c4ab81ca78d1950.diff
LOG: [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.
Added:
Modified:
compiler-rt/lib/asan/asan_thread.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h
index 77f61a3cacc50ea..62f1b5337fe4bf3 100644
--- a/compiler-rt/lib/asan/asan_thread.h
+++ b/compiler-rt/lib/asan/asan_thread.h
@@ -56,6 +56,13 @@ class AsanThreadContext final : public ThreadContextBase {
// AsanThreadContext objects are never freed, so we need many of them.
COMPILER_CHECK(sizeof(AsanThreadContext) <= 256);
+#if defined(_MSC_VER) && !defined(__clang__)
+// MSVC raises a warning about a nonstandard extension being used for the 0
+// sized element in this array. Disable this for warn-as-error builds.
+# pragma warning(push)
+# pragma warning(disable : 4200)
+#endif
+
// AsanThread are stored in TSD and destroyed when the thread dies.
class AsanThread {
public:
@@ -185,6 +192,10 @@ class AsanThread {
char start_data_[];
};
+#if defined(_MSC_VER) && !defined(__clang__)
+# pragma warning(pop)
+#endif
+
// Returns a single instance of registry.
ThreadRegistry &asanThreadRegistry();
ThreadArgRetval &asanThreadArgRetval();
More information about the llvm-commits
mailing list