[libcamera-devel] clang-format: Enable BreakBeforeTernaryOperators

Message ID 20190130111349.20891-1-kieran.bingham@ideasonboard.com
State Accepted
Commit 8400bdd19adfe4f904c971f6ef6ef9499896fa4d
Headers show
Series
  • [libcamera-devel] clang-format: Enable BreakBeforeTernaryOperators
Related show

Commit Message

Kieran Bingham Jan. 30, 2019, 11:13 a.m. UTC
This produces code with the ternary operators at the beginning instead of the
end of the line:

       return caps_.isMultiplanar() ? getFormatMultiplane(fmt)
                                    : getFormatSingleplane(fmt);

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 .clang-format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart Jan. 30, 2019, 12:26 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Wed, Jan 30, 2019 at 11:13:49AM +0000, Kieran Bingham wrote:
> This produces code with the ternary operators at the beginning instead of the
> end of the line:
> 
>        return caps_.isMultiplanar() ? getFormatMultiplane(fmt)
>                                     : getFormatSingleplane(fmt);
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .clang-format | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/.clang-format b/.clang-format
> index 59a61d050e3d..d4669dd93f8d 100644
> --- a/.clang-format
> +++ b/.clang-format
> @@ -47,7 +47,7 @@ BraceWrapping:
>  BreakBeforeBinaryOperators: None
>  BreakBeforeBraces: Custom
>  #BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
> -BreakBeforeTernaryOperators: false
> +BreakBeforeTernaryOperators: true
>  BreakConstructorInitializersBeforeComma: false
>  #BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
>  BreakAfterJavaFieldAnnotations: false

Patch

diff --git a/.clang-format b/.clang-format
index 59a61d050e3d..d4669dd93f8d 100644
--- a/.clang-format
+++ b/.clang-format
@@ -47,7 +47,7 @@  BraceWrapping:
 BreakBeforeBinaryOperators: None
 BreakBeforeBraces: Custom
 #BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
-BreakBeforeTernaryOperators: false
+BreakBeforeTernaryOperators: true
 BreakConstructorInitializersBeforeComma: false
 #BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
 BreakAfterJavaFieldAnnotations: false