[PATCH] D122874: [clang] Add GNU spelling for no_unqiue_address attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 12:43:59 PDT 2022


aaron.ballman added a comment.

In D122874#3442887 <https://reviews.llvm.org/D122874#3442887>, @ldionne wrote:

> I actually think that `[[no_unique_address]]` and `__attribute__((no_unique_address))` should be equivalent. Similarly, we should be able to do `[[msvc::no_unique_address]]` and `__attribute__((msvc::no_unique_address))`, and both should be equivalent.

I don't see how that works if `[[no_unique_address]]` and `[[msvc_no_unique_address]]` have different ABIs in practice, and we don't know what's going to happen there.

I agree with you in theory because I keep hoping that Microsoft will add support for `[[no_unique_address]]` and I really hope it's identical to `[[msvc::no_unique_address]]` when they do. However, Microsoft has not defined the ABI for `[[no_unique_address]]` because they don't support it (so neither do we; we don't know HOW to be compatible without a potential ABI break). We discussed supporting `[[msvc::no_unique_address]]` as part of https://github.com/llvm/llvm-project/issues/49358, and I'd be fine supporting that, but someone has to do the actual legwork to figure out what Microsoft's ABI is for it; thus far, nobody has been willing to do that work and Microsoft has gone silent on the thread once I started asking for details.

Long-term, I think users are going to expect `__attribute__((no_unique_address))` to have the same behavior and ABI as `[[no_unique_address]]` instead of `[[msvc::no_unique_address]]` if the two attributes end up having an ABI difference.

> Which one we pick for use in libc++ is a different issue, and we do it through a macro anyway so that we could easily change it in the future if we wanted.

+1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122874/new/

https://reviews.llvm.org/D122874



More information about the cfe-commits mailing list