[clang] [Frontend][Sema] Add CC1-only -fms-anonymous-structs to enable Microsoft anonymous struct/union feature (PR #176551)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 26 05:28:41 PST 2026


================
@@ -8,6 +8,25 @@
 // RUN:   -Wno-pointer-to-int-cast -Wmicrosoft -verify=ms-anonymous -fms-compatibility
 // RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wno-unused-value \
 // RUN:   -Wno-pointer-to-int-cast -Wmicrosoft -verify=ms-anonymous-dis
+// Test that explicit -fno-ms-anonymous-structs does not enable the feature
+// RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wno-unused-value \
+// RUN:   -Wno-pointer-to-int-cast -Wmicrosoft -verify=ms-anonymous-dis \
+// RUN:   -fno-ms-anonymous-structs
+// Test that explicit -fno-ms-anonymous-structs overrides -fms-anonymous-structs
+// RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wno-unused-value \
+// RUN:   -Wno-pointer-to-int-cast -Wmicrosoft -verify=ms-anonymous-dis \
+// RUN:   -fms-anonymous-structs -fno-ms-anonymous-structs
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -fsyntax-only -Wno-unused-value \
+// RUN:   -Wno-pointer-to-int-cast -Wmicrosoft -verify=ms-anonymous-dis \
+// RUN:   -fms-anonymous-structs -fno-ms-anonymous-structs
+// Test that explicit -fno-ms-anonymous-structs overrides -fms-extensions
----------------
AaronBallman wrote:

The answer I would expect is "last flag wins", so I would expect that to enable the extension.

https://github.com/llvm/llvm-project/pull/176551


More information about the cfe-commits mailing list