Merge common attribute handling code between Ada and c-family. #244

Closed
imperio wants to merge 1 commit from imperio:ada-common-attrs into trunk
Member

Follow-up of #207 and of #241.

It merges common code for attributes handling between the Ada front-end and attr-handlers.c. I renamed some functions by prepending them with ada_ when it was also functions present in attr-handlers.h.

CC: gcc-ada@gcc.gnu.org @dkm

Follow-up of https://forge.sourceware.org/gcc/gcc/pulls/207 and of https://forge.sourceware.org/gcc/gcc/pulls/241. It merges common code for attributes handling between the Ada front-end and `attr-handlers.c`. I renamed some functions by prepending them with `ada_` when it was also functions present in `attr-handlers.h`. CC: gcc-ada@gcc.gnu.org @dkm
Author
Member

/submit

/submit
dkm requested review from dkm 2026-10-08 13:22:02 +00:00
Member

Hi @imperio. This bot helps send your PR as a patch series to the mailing list.

Next steps

  1. Write a clear PR description. It will be used as the cover letter.
  2. To CC extra people, add lines like this at the end of the PR description: CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>.
  3. To preview the emails, comment with /preview.
  4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with /submit.
  5. Use the cover-letter links below to follow replies.
  6. For a new patch series, push your changes, update the PR description with a Changes since vX section, and comment with /submit again.

See Submitting Patches and UsingForge.

Consider joining the gcc and gcc-patches mailing lists..
For real time communication, check the gcc irc channels.

Or join #overseers on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).

<!-- pr-welcome --> Hi @imperio. This bot helps send your PR as a patch series to the mailing list. ## Next steps 1. Write a clear PR description. It will be used as the cover letter. 2. To CC extra people, add lines like this **at the end** of the PR description: `CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>`. 3. To preview the emails, comment with `/preview`. 4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with `/submit`. 5. Use the cover-letter links below to follow replies. 6. For a new patch series, push your changes, update the PR description with a `Changes since vX` section, and comment with `/submit` again. See [Submitting Patches](https://gcc.gnu.org/contribute.html#patches) and [UsingForge](https://gcc.gnu.org/wiki/UsingForge). Consider joining the [gcc and gcc-patches mailing lists.](https://gcc.gnu.org/lists.html). For real time communication, check the [gcc irc channels](https://gcc.gnu.org/wiki/GCConIRC). Or join [`#overseers`](https://web.libera.chat/#overseers) on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).
Member
Cannot post as:
<!-- pr-not-posted -->Cannot post as: - gcc-ada@gcc.gnu.org @dkm is not a valid email address
Member

@forge-bot wrote in #244 (comment):

Cannot post as:

* [gcc-ada@gcc.gnu.org](mailto:gcc-ada@gcc.gnu.org) @dkm is not a valid email address

There's indeed no ada mailing list, and my forge handle isn't enough for any smtp to send me an email 😅 But I have the review on my TODO list, so that's fine.

@forge-bot wrote in https://forge.sourceware.org/gcc/gcc/pulls/244#issuecomment-7789: > Cannot post as: > > * [gcc-ada@gcc.gnu.org](mailto:gcc-ada@gcc.gnu.org) @dkm is not a valid email address There's indeed no ada mailing list, and my forge handle isn't enough for any smtp to send me an email 😅 But I have the review on my TODO list, so that's fine.
dkm left a comment

See my first comment about the renaming. Apart from that, I think the changes are good 👍

See my first comment about the renaming. Apart from that, I think the changes are good 👍
@ -141,4 +123,0 @@
static const struct attribute_spec::exclusions attr_noinline_exclusions[] =
{
{ "always_inline", true, true, true },
Member

I see the common part has gnu_inline here, that's probably missing in the ada version.

I see the common part has `gnu_inline` here, that's probably missing in the ada version.
Author
Member

Do you want me to add it in this patch or in a follow-up?

Do you want me to add it in this patch or in a follow-up?
Member

Not sure I understand. While reviewing, I saw a small difference between the current Ada definition and the common (new) one. The common has the gnu_inline, but the Ada doesn't. I believe the attribute is currently missing in the Ada, so your change also fixes this as a side effect. I don't think you need to do anything about it. Or maybe I'm missing something 😅

Not sure I understand. While reviewing, I saw a small difference between the current Ada definition and the common (new) one. The common has the `gnu_inline`, but the Ada doesn't. I believe the attribute is currently missing in the Ada, so your change also fixes this as a side effect. I don't think you need to do anything about it. Or maybe I'm missing something 😅
dkm marked this conversation as resolved
@ -88,3 +89,2 @@
/* Forward declarations for handlers of attributes. */
static tree handle_const_attribute (tree *, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
static tree ada_handle_const_attribute (tree *, tree, tree, int, bool *);
Member

I wonder if we should rename all functions instead of simply prefixing a subset. Having some function prefixed and some not may confuse reader into believing they are different. What do you think?

I wonder if we should rename all functions instead of simply prefixing a subset. Having some function prefixed and some not may confuse reader into believing they are different. What do you think?
Author
Member

I'm fine with either solution. You seem to prefer prefixing them all with ada_ so I'll do so.

I'm fine with either solution. You seem to prefer prefixing them all with `ada_` so I'll do so.
dkm marked this conversation as resolved
Member
Cannot publish to mailing list as:
<!-- pr-not-posted -->Cannot publish to mailing list as: - gcc-ada@gcc.gnu.org @dkm is not a valid email address
imperio force-pushed ada-common-attrs from 18c2d246a9
All checks were successful
/ format-checks (pull_request) Successful in 1m24s
to a32bdf9326
Some checks failed
/ format-checks (pull_request) Failing after 1m26s
2026-10-20 09:38:03 +00:00
Compare
Author
Member

Renamed the functions.

Renamed the functions.
Member

You probably need to update the changelog part of your commit because you have more renamings, and not all because of conflicting names 😅

You probably need to update the changelog part of your commit because you have more renamings, and not all because of conflicting names 😅
Author
Member

GCC commit message. My old nemesis.

GCC commit message. My old nemesis.
imperio force-pushed ada-common-attrs from a32bdf9326
Some checks failed
/ format-checks (pull_request) Failing after 1m26s
to 4e832f293e
Some checks failed
/ format-checks (pull_request) Failing after 1m28s
2026-10-20 14:18:01 +00:00
Compare
imperio force-pushed ada-common-attrs from 4e832f293e
Some checks failed
/ format-checks (pull_request) Failing after 1m28s
to b34c994f6c
All checks were successful
/ format-checks (pull_request) Successful in 1m28s
2026-10-20 14:19:39 +00:00
Compare
Author
Member

Fixed commit message.

Fixed commit message.
Member

@imperio wrote in #244 (comment):

Fixed commit message.

Thanks, look good now 👍

@imperio wrote in https://forge.sourceware.org/gcc/gcc/pulls/244#issuecomment-7882: > Fixed commit message. Thanks, look good now 👍
dkm approved these changes 2026-10-22 14:19:48 +00:00
Member
Cannot publish to mailing list as:
<!-- pr-not-posted -->Cannot publish to mailing list as: - gcc-ada@gcc.gnu.org @dkm is not a valid email address
Author
Member

Patch was merged as commit 1f54bb3ff1. Closing.

Patch was merged as commit 1f54bb3ff18f85bd9e391c9a6ce85f26d4d17fc1. Closing.
imperio closed this pull request 2026-10-22 14:41:48 +00:00
imperio deleted branch ada-common-attrs 2026-10-22 14:41:53 +00:00
All checks were successful
/ format-checks (pull_request) Successful in 1m28s

Pull request closed

Sign in to join this conversation.
No reviewers
dkm
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gcc/gcc!244
No description provided.