Skip to content

Conversation

jnewbery
Copy link
Contributor

In some cases, running clang-format has made code less readable by joining declarations and calls for functions with many arguments into very long lines. For example:

-    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
-                        std::chrono::system_clock::time_point &last) const;
+    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;

(#19090 (comment))

This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is BinPackParameters : true).

Allow arguments and parameters to be split over multiple lines
if they don't fit on one line
@maflcko
Copy link
Member

maflcko commented Jun 17, 2020

ACK cc29d1e fine with me

@practicalswift
Copy link
Contributor

ACK cc29d1e

@maflcko maflcko merged commit e6f807f into bitcoin:master Jun 21, 2020
@jnewbery jnewbery deleted the 2020-05-clang-tidy branch June 21, 2020 12:19
@troygiorshev
Copy link
Contributor

Posthumous ACK cc29d1e.

For future reference, the addition of AllowAllArgumentsOnNextLine : true in this PR bumps the required version of clang-format up to 9.

Glancing briefly at https://distrowatch.com/ and https://pkgs.org/search/?q=clang it doesn't look like this will be a problem for most developers.

Recent (19.04+) ubuntu releases are already at version 9. Older ubuntu releases and related distros can easily upgrade by installing clang-format-9. Arch or Manjaro or related look like they're already there for recent-ish versions. RHEL derivatives look like they're already there. Debian and related look to be the most problematic, but they can use https://apt.llvm.org/.

@jonatack
Copy link
Member

jonatack commented Jun 30, 2020

This is a breaking change for me on Debian with Clang 6, and the last time I tried to install llvm from source was an unsuccessful rabbit hole.

@maflcko
Copy link
Member

maflcko commented Jun 30, 2020

I wasn't aware that this requires clang-9 and indeed debian stable does not seem to have clang-9:

https://packages.debian.org/search?keywords=clang-format-9

@maflcko
Copy link
Member

maflcko commented Jun 30, 2020

Maybe the AllowAllArgumentsOnNextLine setting can be removed for now while still keeping the other setting changes?

@jnewbery
Copy link
Contributor Author

Sorry, this is my fault. Sadly https://clang.llvm.org/docs/ClangFormatStyleOptions.html doesn't document which configuration options are valid on which versions, so I missed that AllowAllArgumentsOnNextLine requires V9.

Maybe the AllowAllArgumentsOnNextLine setting can be removed for now while still keeping the other setting changes?

Fine by me.

@jonatack
Copy link
Member

jonatack commented Jul 6, 2020

Thanks! Done in #19454.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 7, 2020
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
fanquake added a commit that referenced this pull request Jul 9, 2020
b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in #19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from #19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 9, 2020
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
…e function declarations and calls

cc29d1e [tools] Update clang-format config (John Newbery)

Pull request description:

  In some cases, running clang-format has made code _less_ readable by joining declarations and calls for functions with many arguments into very long lines. For example:

  ```
  -    size_t getQueueInfo(std::chrono::system_clock::time_point &first,
  -                        std::chrono::system_clock::time_point &last) const;
  +    size_t getQueueInfo(std::chrono::system_clock::time_point& first, std::chrono::system_clock::time_point& last) const;
  ```

  (bitcoin#19090 (comment))

  This change to clang-format would allow arguments/parameters for func declarations/calls to be split over multiple lines, aligned with the opening parens. It does not force args/params to be on new lines (that setting is `BinPackParameters : true`).

ACKs for top commit:
  MarcoFalke:
    ACK cc29d1e fine with me
  practicalswift:
    ACK cc29d1e

Tree-SHA512: a62474925e71aaff41bdce7960fd5ffd64317da810f694d8084080b054708cf71c2ab2ce3111db5a9260d1c1f9e02d59a2ecb5543b1b6172ce085cb42432160a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 15, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 16, 2021
…s < 9

b9253c7 tools: clang-format 6 compatibility (Jon Atack)

Pull request description:

  Our `.clang-format` settings inadvertently lost compatibility with Clang versions < 9 in bitcoin#19095, including for Debian stable. This patch returns compatibility in the interim until the distros update. See discussion from bitcoin#19095 (comment).

ACKs for top commit:
  MarcoFalke:
    Approach ACK b9253c7 , haven't tested

Tree-SHA512: 4af541a195f48d84ffb80e23aaefb624c66bc78f087c8d92b4af5a654420b69fedf25272c6e4fde2688ff88412d306b7a990ce1e15d8b24180374c625a253fb6
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants