Sorry, I walked away from this a bit and I need to rebase this patch
and resubmit it.

>It seems to me that supporting gnu:: and clang:: with the same
>semantics just complicates code portability; if the goal is to handle
>existing code, that means supporting the existing spelling.

Are you saying that supporting the [[clang::trivial_abi]] and
__attribute__((__trivial_abi__)) spellings would be enough? Because
these are "existing" from my point of view. No gnu:: version is
needed?

>Please do not edit ChangeLog files, they are automatically generated
>from the Git commit history.

Gotcha.

On Tue, Feb 17, 2026 at 2:59 AM Jonathan Wakely <[email protected]> wrote:
>
> On Mon, 17 Nov 2025 at 16:03 -0800, Yuxuan Chen wrote:
> >Implement the trivial_abi attribute for GCC to fix ABI compatibility
> >issues with Clang. Currently, GCC silently ignores this attribute,
> >causing call convention mismatches when linking GCC-compiled code with
> >Clang-compiled object files that use trivial_abi types.
> >
> >This attribute allows types to be treated as trivial for ABI purposes,
> >enabling pass in registers instead of invisible references.
> >
> >        PR c++/107187
> >
> >V3 changes from v2:
> >    - Handling cases where bases can be dependent.
> >    - gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi_syntax.C now uses the same
> >      test as Clang to ensure no difference in semantics.
> >
> >V2 changes from v1:
> >    - Addressing code review comments.
> >    - Registered cleanup in callee for trivial abi. Added test
> >      `gcc/testsuite/g++.dg/abi/invisiref3a.C`
> >    - Added doc in `gcc/doc/extend.texi`. Pretty much the same as in
> >      Clang's attributes documentation.
>
> >From 1ed8f7b49c1f676a4f8b1b331ff7eac140ebaa4b Mon Sep 17 00:00:00 2001
> >From: Yuxuan Chen <[email protected]>
> >Date: Tue, 7 Oct 2025 14:17:35 -0700
> >Subject: [PATCH] c++: Add support for [[gnu::trivial_abi]] attribute
> > [PR107187]
> >
> >Changes from v2:
> >- Handling cases where bases can be dependent.
> >- gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi_syntax.C now uses the same
> >  test as Clang to ensure no difference in semantics.
> >
> >Changes from v1:
> >- Addressing code review comments.
> >- Registered cleanup in callee for trivial abi. Added test
> >  `gcc/testsuite/g++.dg/abi/invisiref3a.C`
> >- Added doc in `gcc/doc/extend.texi`. Pretty much the same as in
> >  Clang's attributes documentation.
> >
> >Implement the trivial_abi attribute for GCC to fix ABI compatibility
> >issues with Clang. Currently, GCC silently ignores this attribute,
> >causing call convention mismatches when linking GCC-compiled code with
> >Clang-compiled object files that use trivial_abi types.
> >
> >This attribute allows types to be treated as trivial for ABI purposes,
> >enabling pass in registers instead of invisible references.
> >
> >    PR c++/107187
> >
> >gcc/cp/ChangeLog:
> >
> >    * cp-tree.h (struct lang_type): Add has_trivial_abi flag.
> >    * tree.cc (trivially_relocatable_type_p): Check for
> >    trivial_abi attribute.
> >    (handle_trivial_abi_attribute): Implement attribute validation.
> >    (cxx_gnu_attributes): Add trivial_abi entry.
> >    * class.cc (finish_struct_bits): Respect trivial_for_calls_p.
> >    * decl.cc (store_parm_decls): Register cleanups for trivial_abi
> >    parameters.
> >    * pt.cc (instantiate_class_template): Propagate
> >    CLASSTYPE_HAS_TRIVIAL_ABI in template instantiation.
> >    * module.cc (trees_out::lang_type_bools, trees_in::lang_type_bools):
> >    Serialize has_trivial_abi.
> >
> >Signed-off-by: Yuxuan Chen <[email protected]>
> >---
> > gcc/cp/ChangeLog                              |  16 ++
> > gcc/cp/class.cc                               |  25 ++-
> > gcc/cp/cp-tree.h                              |  12 +-
> > gcc/cp/decl.cc                                |  17 ++
> > gcc/cp/module.cc                              |   2 +
> > gcc/cp/pt.cc                                  |   1 +
> > gcc/cp/tree.cc                                | 143 +++++++++++++++-
> > gcc/doc/extend.texi                           |  69 ++++++++
> > gcc/testsuite/g++.dg/abi/invisiref3.C         |  28 +++
> > gcc/testsuite/g++.dg/abi/invisiref3a.C        |  26 +++
> > .../g++.dg/cpp0x/attr-trivial_abi1.C          |  48 ++++++
> > .../g++.dg/cpp0x/attr-trivial_abi2.C          |  70 ++++++++
> > .../g++.dg/cpp0x/attr-trivial_abi3.C          |  61 +++++++
> > .../g++.dg/cpp0x/attr-trivial_abi4.C          |  75 ++++++++
> > .../g++.dg/cpp0x/attr-trivial_abi5.C          |  83 +++++++++
> > .../g++.dg/cpp0x/attr-trivial_abi_syntax.C    | 161 ++++++++++++++++++
> > 16 files changed, 826 insertions(+), 11 deletions(-)
> > create mode 100644 gcc/testsuite/g++.dg/abi/invisiref3.C
> > create mode 100644 gcc/testsuite/g++.dg/abi/invisiref3a.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi1.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi2.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi3.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi4.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi5.C
> > create mode 100644 gcc/testsuite/g++.dg/cpp0x/attr-trivial_abi_syntax.C
> >
> >diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
> >index 95b471d4984..e18c0812f56 100644
> >--- a/gcc/cp/ChangeLog
> >+++ b/gcc/cp/ChangeLog
> >@@ -1,3 +1,19 @@
> >+2025-11-05  Yuxuan Chen  <[email protected]>
> >+
> >+      PR c++/107187
> >+      * cp-tree.h (struct lang_type): Add has_trivial_abi flag.
> >+      * tree.cc (trivially_relocatable_type_p): Check for
> >+      trivial_abi attribute.
> >+      (handle_trivial_abi_attribute): Implement attribute validation.
> >+      (cxx_gnu_attributes): Add trivial_abi entry.
> >+      * class.cc (finish_struct_bits): Respect trivial_for_calls_p.
> >+      * decl.cc (store_parm_decls): Register cleanups for trivial_abi
> >+      parameters.
> >+      * pt.cc (instantiate_class_template): Propagate
> >+      CLASSTYPE_HAS_TRIVIAL_ABI in template instantiation.
> >+      * module.cc (trees_out::lang_type_bools, trees_in::lang_type_bools):
> >+      Serialize has_trivial_abi.
> >+
>
> Please do not edit ChangeLog files, they are automatically generated
> from the Git commit history. If you edit the file by hand and include
> that in your patch, it makes it impossible to automatically apply the
> patch using 'git am' or 'b4 shazam', because the context doesn't
> match.
>
> You already included the ChangeLog entry in your git commit message,
> which is the correct thing to do. If the patch gets pushed to git then
> that ChangeLog entry will be copied from the commit log into the
> actual ChangeLog file.
>
>

Reply via email to