[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
Sun Jan 25 09:31:21 PST 2026


================
@@ -12,7 +12,13 @@
 // RUN: %clang_cc1 -triple powerpc-ibm-aix -fms-extensions -fms-anonymous-structs %s -fsyntax-only 2>&1 | \
 // RUN:     FileCheck --check-prefix=CC1-OK %s --allow-empty
 
-// Test rejection of the unsupported negative form.
-// RUN: not %clang_cc1 -triple powerpc-ibm-aix -fno-ms-anonymous-structs %s -fsyntax-only 2>&1 | \
-// RUN:     FileCheck %s
-// CHECK: error: unknown argument: '-fno-ms-anonymous-structs'
+// Test that -fno-ms-anonymous-structs is accepted by CC1 without error.
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fno-ms-anonymous-structs %s -fsyntax-only 2>&1 | \
+// RUN:     FileCheck --check-prefix=CC1-OK %s --allow-empty
+
+// Test toggling between enable and disable (last one wins)
----------------
hubert-reinterpretcast wrote:

This does _not_ test the "last one wins" aspect.
Minor nit: Periods are not omitted for code comments in LLVM (iiuc). In any case, the comment above uses a period.
```suggestion
// Test both orderings of using both the negative and positive forms.
```

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


More information about the cfe-commits mailing list