[clang] [clang] Implement gcc_struct attribute on Itanium targets (PR #71148)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 9 09:43:21 PST 2025
Martin =?utf-8?q?Storsjö?= <martin at martin.st>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/71148 at github.com>
================
@@ -9630,3 +9630,19 @@ silence diagnostics with code like:
__attribute__((nonstring)) char NotAStr[3] = "foo"; // Not diagnosed
}];
}
+
+def MSStructDocs : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+The ``ms_struct`` and ``gcc_struct`` attributes request the compiler to enter a
+special record layout compatibility mode which mimics the layout of Microsoft or
+Itanium C++ ABI respectively. Obviously, if the current C++ ABI matches the
+requested ABI, the attribute does nothing. However, if it does not, annotated
+structure or class is laid out in a special compatibility mode, which slightly
+changes offsets for fields and bit-fields. The intention is to match the layout
+of the requested ABI for structures which only use C features.
+
+Note that the default behavior can be controlled by ``-mms-bitfields`` and
----------------
erichkeane wrote:
It would be worth expanding on this documentation to include WHAT the differences (at least at the high level) between the two layouts is, and why one might want to use it.
https://github.com/llvm/llvm-project/pull/71148
More information about the cfe-commits
mailing list