[PATCH] D155529: [clang-format] Add SpaceInParensOption for __attribute__ keyword

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 04:30:59 PDT 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:4208-4213
+    /// Put a space in parentheses inside attribute specifier lists.
+    /// \code
+    ///    true:                                  false:
+    ///    __attribute__(( noreturn ))    vs.     __attribute__((noreturn))
+    /// \endcode
+    bool InAttributeSpecifierLists;
----------------
gedare wrote:
> owenpan wrote:
> > This should be covered by `SpacesInParetheses`, so we really should not have a special option for `__attribute__`.
> Currently, the behavior of `SpacesInParentheses` does this:
> ```
> __attribute__( ( noreturn ) )
> ```
> In order to prevent this from happening, it is necessary to add an option to disable it somehow, because I don't see that this kind of spacing should ever be used by anyone, but probably someone does it, and it should be maintained for backward compatibility anyway.
> Currently, the behavior of `SpacesInParentheses` does this:
> ```
> __attribute__( ( noreturn ) )
> ```
> In order to prevent this from happening, it is necessary to add an option to disable it somehow, because I don't see that this kind of spacing should ever be used by anyone, but probably someone does it, and it should be maintained for backward compatibility anyway.

And what does clang-format do before your `SpacesInParentheses`? You should expand the tests to cover the attributes (if they aren't in there already).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155529



More information about the cfe-commits mailing list