diff mbox series

clang-format AlwaysBreakAfterReturnType to TopLevelDefinitions

Message ID 20241209143645.594876-1-mmalcomson@nvidia.com
State New
Headers show
Series clang-format AlwaysBreakAfterReturnType to TopLevelDefinitions | expand

Commit Message

Matthew Malcomson Dec. 9, 2024, 2:36 p.m. UTC
From: Matthew Malcomson <mmalcomson@nvidia.com>

The previous value of TopLevel meant that the function name of
declarations would also be on a new line.  This does not match the
current formatting of headers.

Manual testing done on c-common.h.

Also set BraceWrapping.BeforeWhile to true to match the formatting
specified for do/while loops in GNU coding standards.
https://www.gnu.org/prep/standards/standards.html#Formatting

Ok for trunk?

contrib/ChangeLog:

	* clang-format: AlwaysBreakAfterReturnType set to
	TopLevelDefinitions and BraceWrapping.BeforeWhile set to true.

Signed-off-by: Matthew Malcomson <mmalcomson@nvidia.com>
---
 contrib/clang-format | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jason Merrill Dec. 9, 2024, 4:42 p.m. UTC | #1
On 12/9/24 9:36 AM, mmalcomson@nvidia.com wrote:
> From: Matthew Malcomson <mmalcomson@nvidia.com>
> 
> The previous value of TopLevel meant that the function name of
> declarations would also be on a new line.  This does not match the
> current formatting of headers.
> 
> Manual testing done on c-common.h.
> 
> Also set BraceWrapping.BeforeWhile to true to match the formatting
> specified for do/while loops in GNU coding standards.
> https://www.gnu.org/prep/standards/standards.html#Formatting
> 
> Ok for trunk?

OK.

> contrib/ChangeLog:
> 
> 	* clang-format: AlwaysBreakAfterReturnType set to
> 	TopLevelDefinitions and BraceWrapping.BeforeWhile set to true.
> 
> Signed-off-by: Matthew Malcomson <mmalcomson@nvidia.com>
> ---
>   contrib/clang-format | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/clang-format b/contrib/clang-format
> index 95f1455c14d..4ed50ab6b26 100644
> --- a/contrib/clang-format
> +++ b/contrib/clang-format
> @@ -27,7 +27,7 @@
>   ---
>   Language: Cpp
>   AccessModifierOffset: -2
> -AlwaysBreakAfterReturnType: TopLevel
> +AlwaysBreakAfterReturnType: TopLevelDefinitions
>   BinPackArguments: true
>   BinPackParameters: true
>   BraceWrapping:
> @@ -42,6 +42,7 @@ BraceWrapping:
>     AfterUnion: true
>     BeforeCatch: true
>     BeforeElse: true
> +  BeforeWhile: true
>     IndentBraces: true
>     SplitEmptyFunction: false
>   BreakBeforeBinaryOperators: All
diff mbox series

Patch

diff --git a/contrib/clang-format b/contrib/clang-format
index 95f1455c14d..4ed50ab6b26 100644
--- a/contrib/clang-format
+++ b/contrib/clang-format
@@ -27,7 +27,7 @@ 
 ---
 Language: Cpp
 AccessModifierOffset: -2
-AlwaysBreakAfterReturnType: TopLevel
+AlwaysBreakAfterReturnType: TopLevelDefinitions
 BinPackArguments: true
 BinPackParameters: true
 BraceWrapping:
@@ -42,6 +42,7 @@  BraceWrapping:
   AfterUnion: true
   BeforeCatch: true
   BeforeElse: true
+  BeforeWhile: true
   IndentBraces: true
   SplitEmptyFunction: false
 BreakBeforeBinaryOperators: All