[PATCH v1 0/1] Merge common attribute handling code between libgccjit and `gcc/c-family`

Guillaume Gomez via Sourceware Forge <forge-bot+imperio-Wfwr+2zPm/[email protected]> Mon, 03 Aug 2026 14:37:02 +0000
Newsgroups gmane.comp.gcc.jit,gmane.comp.gcc.patches
Message-ID <bmm.hl02ewfvoa.gcc.gcc.imperio.207.1.0@forge-stage.sourceware.org>
Hi gcc-patches mailing list,
Guillaume Gomez via Sourceware Forge <forge-bot+imperio-Wfwr+2zPm/[email protected]> has requested that the following forgejo pull request
be published on the mailing list.

Created on: 2026-07-30 15:38:05+00:00
Latest update: 2026-08-03 14:37:04+00:00
Changes: 6 changed files, 988 additions, 1462 deletions
Head revision: imperio/gcc ref attr-dedup commit a9a4bb08931f95489f64af2a505a8dda432a8b71
Base revision: gcc/gcc ref trunk commit ece564fdaa15a0da008cedd881afcd3f0f4dbd5a r17-2824-gece564fdaa15a0
Merge base: ece564fdaa15a0da008cedd881afcd3f0f4dbd5a
Full diff url: https://forge.sourceware.org/gcc/gcc/pulls/207.diff
Discussion:  https://forge.sourceware.org/gcc/gcc/pulls/207
Requested Reviewers:

This is my third attempt at removing duplicated code between `libgccjit` and `gcc/c-family` and it seems like I was able to make it work with the help of @antoyo for the Makefile files in particular.

So this is what I did: moving code from `gcc/c-family.cc` into `gcc/attr-handlers.cc`, then I remove the duplicated code in `jit/dummy-frontend.cc`. There is one exception though: since libgccjit implementation of the `malloc` attribute is a sub-part of the `gcc/c-family.cc` implementation, I created a new `handle_malloc_common` function which is called directly by libgccjit and called under a specific condition in `gcc/c-family.cc`.

There are still duplicated code attributes remaining in libgccjit, but the patch is already big enough as it is so I stopped at this point.


Changed files:
- A: gcc/attr-handlers.cc
- A: gcc/attr-handlers.h
- M: gcc/Makefile.in
- M: gcc/c-family/c-attribs.cc
- M: gcc/jit/Make-lang.in
- M: gcc/jit/dummy-frontend.cc


Guillaume Gomez (1):
  Merge common attribute handling code between libgccjit and c-family.

 gcc/Makefile.in           |   2 +-
 gcc/attr-handlers.cc      | 896 ++++++++++++++++++++++++++++++++++++++
 gcc/attr-handlers.h       |  61 +++
 gcc/c-family/c-attribs.cc | 844 +----------------------------------
 gcc/jit/Make-lang.in      |   1 +
 gcc/jit/dummy-frontend.cc | 646 +--------------------------
 6 files changed, 988 insertions(+), 1462 deletions(-)
 create mode 100644 gcc/attr-handlers.cc
 create mode 100644 gcc/attr-handlers.h

-- 
2.54.0