public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Roy Jacobson <roi.jacobson1@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Alexandre Oliva <oliva@adacore.com>,
	gcc@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>,
	 Eric Botcazou <ebotcazou@adacore.com>,
	Jan Hubicka <hubicka@ucw.cz>,
	 "Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: Last call for bikeshedding on attribute sym/exalias/reverse_alias
Date: Fri, 8 Sep 2023 11:46:25 +0300	[thread overview]
Message-ID: <CACpPL6sBHE1J-K6qTUeS3Hmd3wgC-Jz7Q6fopBE0WG5nebGi5A@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdQ3vT3MjohuE-izto+K=BMRykY3T-UyWa5-=OTDPM-JsQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3444 bytes --]

There's a related [[preferred_name]] attribute in Clang but it's not a
success story. If you come up with something more usable I think we'll be
happy to implement it as well :)

https://clang.llvm.org/docs/AttributeReference.html#preferred-name


On Fri, 8 Sept 2023, 11:34 Jonathan Wakely via Gcc, <gcc@gcc.gnu.org> wrote:

> On Fri, 8 Sept 2023, 06:26 Alexandre Oliva via Gcc, <gcc@gcc.gnu.org>
> wrote:
>
> > Since 2020 I've been trying to introduce an attribute that operates a
> > bit like alias, but instead of defining a declaration as an alias to
> > another defined declaration, it merely exposes the present declaration
> > with an alternate mnemonic symbol name, so that it can be further
> > aliased, imported or referenced elsewhere with an invariant name, rather
> > than with a mangled name.  E.g.:
> >
> > // C++
> > namespace foo {
> >   int __attribute__ ((__???__ ("FOOVAR")))
> >   var = 42; // FOOVAR is an asm alias to the mangled name for foo::var
> > }
> >
> > --  Ada
> > package Foo is
> >   Var : Integer;
> >   pragma Import (CPP, FooVar, "FOOVAR");
> >   --  use the mnemonic alias rather than the mangled name.
> >
> >
> > The implementation also handles C++ cdtors, modifying the mnemonic alias
> > of each clone so that they don't clash, and typeinfo objects generated
> > for classes when the attribute is associated with a class.
> >
>
> Very cool, we have immediate uses for this in libstdc++.
>
> Personally I think calling it some form of "alias" focuses on the
> implementation details of how its done behind the scenes, not what its
> practical effects are. On the other hand, it would relate it to the
> existing alias attribute which is related.
>
> I think "symname" or "symalias" would be better than just "sym".
>
> Have you contacted anybody in the llvm community to see if they would
> implement it, or maybe already have something similar by another name?
>
>
>
>
> >
> > There don't seem to be objections to the feature per se, but discussions
> > about it have invariably got stuck in debating the attribute name.
> >
> > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551614.html
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624560.html
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624977.html
> >
> >
> > The customer report that motivated this development didn't require its
> > full generality, and asm("symbol") satisfies it.  But I've implemented
> > the feature, I find it useful, others seem to have liked it, and so I'd
> > like it to find its way into GCC.  However, I'm advised to not spend
> > much more time on it.
> >
> > So, instead of updating the patch for every suggested attribute name, my
> > last-attempt plan is to try to reach consensus on the attribute name,
> > and then adjust the patch and submit it one more time.  If that doesn't
> > succeed, I'll leave it for anyone else to take it from there.
> >
> > Attribute sym, named after symver, is the one in the latest version of
> > the patch.  mnemonic_alias, convenience_alias and asm_alias are other
> > possibilities that comes to mind.  The 2020-August thread has many more.
> >
> > --
> > Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
> >    Free Software Activist                   GNU Toolchain Engineer
> > More tolerance and less prejudice are key for inclusion and diversity
> > Excluding neuro-others for not behaving ""normal"" is *not* inclusive
> >
>

  reply	other threads:[~2023-09-08  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <or365aghwf.fsf@livre.home>
     [not found] ` <orzh7673v4.fsf@livre.home>
     [not found]   ` <ory1ji6ky5.fsf_-_@lxoliva.fsfla.org>
     [not found]     ` <e4d300a4-d84a-556b-d94f-904047ab5120@acm.org>
     [not found]       ` <orh6q13ks2.fsf@lxoliva.fsfla.org>
     [not found]         ` <CAFiYyc0TwLXgSUvFYp1BWkN-MvTTcwqHCj7YSybQrzaUn3=LYA@mail.gmail.com>
     [not found]           ` <orwmyvzece.fsf_-_@lxoliva.fsfla.org>
2023-09-08  5:25             ` Alexandre Oliva
2023-09-08  6:01               ` Dave Blanchard
2023-09-08  7:34                 ` Jonathan Wakely
2023-09-08  8:32               ` Jonathan Wakely
2023-09-08  8:46                 ` Roy Jacobson [this message]
2023-09-14 10:01                 ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACpPL6sBHE1J-K6qTUeS3Hmd3wgC-Jz7Q6fopBE0WG5nebGi5A@mail.gmail.com \
    --to=roi.jacobson1@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=joseph@codesourcery.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=nathan@acm.org \
    --cc=oliva@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).