From acef4cc2d7aebee45c4cf87663ee2ae567df7ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 25 Mar 2026 23:41:41 +0200 Subject: [PATCH] [Support] [Windows] Silence warnings about anonymous unions (#188534) When building in mingw mode with Clang, we currently get the following warnings: llvm-project/llvm/lib/Support/Windows/Path.inc:1720:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types] 1720 | struct { | ^ llvm-project/llvm/lib/Support/Windows/Path.inc:1728:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types] 1728 | struct { | ^ Since these declarations mirror parts of the Microsoft SDKs, we don't want to deviate from it needlessly; instead add a pragma to silence this diagnostic for this specific area. --- llvm/lib/Support/Windows/Path.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index 25be38d986aa..48825a2de499 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -1710,6 +1710,10 @@ std::error_code real_path(const Twine &path, SmallVectorImpl &dest, return std::error_code(); } +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnested-anon-types" +#endif // This struct is normally only available in the Windows Driver Kit (WDK) // headers, not in the standard Windows SDK. struct LLVM_REPARSE_DATA_BUFFER { @@ -1737,6 +1741,9 @@ struct LLVM_REPARSE_DATA_BUFFER { } GenericReparseBuffer; }; }; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif std::error_code readlink(const Twine &path, SmallVectorImpl &dest) { dest.clear();