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

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 11:13:09 PST 2026


================
@@ -0,0 +1,15 @@
+// Test that -fms-anonymous-structs is a CC1-only option and properly rejected by driver
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fms-anonymous-structs %s -fsyntax-only 2>&1 | \
+// RUN:     FileCheck --check-prefix=CC1-OK %s --allow-empty
+// CC1-OK-NOT: error: unknown argument
+
+// Test that multiple occurrences are handled
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fms-anonymous-structs -fms-anonymous-structs %s -fsyntax-only 2>&1 | \
+// RUN:     FileCheck --check-prefix=MULTI-OK %s --allow-empty
+// MULTI-OK-NOT: error: unknown argument
+
+// Test with other MS-related options
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fms-extensions -fms-anonymous-structs %s -fsyntax-only 2>&1 | \
+// RUN:     FileCheck --check-prefix=WITH-MS-EXT %s --allow-empty
+// WITH-MS-EXT-NOT: error: unknown argument
----------------
hubert-reinterpretcast wrote:

For the usage we intend to enable, I don't think we need to add a negative form if there isn't one.

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


More information about the cfe-commits mailing list