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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 12:57:50 PST 2022


aaron.ballman added a comment.

Thanks for this, I plan on giving it a more thorough review when I can. But the summary led me to a design question: 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. e.g., https://godbolt.org/z/9v7r6Eanz

  __declspec(deprecated, naked) void f();
  __attribute__((annotate("test"), constructor(0))) void g();
  [[clang::annotate("test"), gnu::constructor(0)]] void h();

What's the use case for letting someone mix and match attribute styles as in:

  #pragma clang attribute push ([[clang::disable_tail_calls]] __attribute__((annotate("test"))), apply_to = function)

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

(Note, I'm still thinking about whether this approach poses any actual problems; it may be perfectly fine, but it'd help to know why we're being lax in mixing forms and what the rationale is for whitespace separation; that's not a common approach to lists of things in C or C++).

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


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