[PATCH] D121283: [Clang] Support multiple attributes in a single pragma

Egor Zhdan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 11 11:32:30 PST 2022


egorzhdan added a comment.

In D121283#3373560 <https://reviews.llvm.org/D121283#3373560>, @aaron.ballman wrote:

> why do we support multiple attribute *specifiers* in the same pragma? I would not expect to be able to mix attribute styles in the same pragma given that all of the individual styles allow you to specify multiple attributes within a single specifier

I don't think I have a strong use case for this. It seemed consistent with the way multiple attributes can be added for individual declarations, e.g. `__attribute__((cdecl)) __declspec(dllexport) [[noreturn]] void f()`. But we can prohibit multiple specifiers within a single pragma if you think that this is not a good construct to support.

In D121283#3373560 <https://reviews.llvm.org/D121283#3373560>, @aaron.ballman wrote:

> why is whitespace the correct separator as opposed to a comma-delimited list?

My motivation for this was also consistency with the syntax for attributes in individual declarations. Given that attribute specifiers are delimited by space for individual declarations (`__attribute__((cdecl)) __attribute__((noreturn)) void f()`), I think it would be unintuitive to require commas for attribute specifiers in pragmas when we could instead reuse the existing syntax of space-delimited attribute specifiers.

In D121283#3373560 <https://reviews.llvm.org/D121283#3373560>, @aaron.ballman wrote:

> Also, I'd expect there to be some documentation changes along with this patch and a release note.

Good point, thanks, I will add those to this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121283



More information about the cfe-commits mailing list