[clang] [clang] Stub out gcc_struct attribute (PR #71148)

Dan Klishch via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 01:00:42 PST 2023


DanShaders wrote:

@rjmccall
The problem will arise only if GCC implements support for MSVC C++ ABI and decides that there is a better way to implement `gcc_struct`. Since, AFAIC, MSVC-compatibility for GCC is not even planned, it's unlikely anybody there will have strong opinions on this. Yet I posted a question on gcc mailing list (https://gcc.gnu.org/pipermail/gcc/2023-December/242963.html) and, unsurprisingly, got no replies in a week.

At the same time, I agree that inventing behavior for attributes in gnu:: namespace feels wrong. So, what do think about putting gcc_struct into `clang::` and disallowing `__attribute__((gcc_struct))`? Looks like this would require minimal changes:
```diff
@@ -3672,7 +3672,7 @@ def MSStruct : InheritableAttr {
 }
 
 def GCCStruct : InheritableAttr {
-  let Spellings = [GCC<"gcc_struct">];
+  let Spellings = [CXX11<"clang", "gcc_struct">, C23<"clang", "gcc_struct">];
   let Subjects = SubjectList<[Record]>;
   let Documentation = [MSStructDocs]; // Covers this attribute too.
   let SimpleHandler = 1;
```

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


More information about the cfe-commits mailing list