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

Gedare Bloom via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 15:53:13 PDT 2023


gedare planned changes to this revision.
gedare added a comment.

I need to fix this to reflect the changes in the parent rev.



================
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;
----------------
HazardyKnusperkeks wrote:
> 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).
`SpacesInParentheses` formats like this: `__attribute__( ( ... ) )`


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