Skip to content

Commit

Permalink
style: clang-format updated to clang 17
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Oct 25, 2023
1 parent 26c79a7 commit 1f14184
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
22 changes: 15 additions & 7 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
########################################################################################
# NOTE: At least clang-format-16 is needed to format the code of this project correctly
########################################################################################
---
BasedOnStyle: Google
---
Expand Down Expand Up @@ -32,6 +29,11 @@ AccessModifierOffset: -2
# AcrossComments: false
# AlignCompound: false
# PadOperators: false
# AlignConsecutiveShortCaseStatements:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCaseColons: false
# AlignEscapedNewlines: Left
# AlignOperands: Align
# AlignTrailingComments:
Expand Down Expand Up @@ -140,6 +142,7 @@ IncludeCategories:
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLinesAtTheStartOfBlocks: false
# KeepEmptyLinesAtEOF: false
# LambdaBodyIndentation: Signature
# LineEnding: DeriveLF
# MacroBlockBegin: ''
Expand Down Expand Up @@ -198,6 +201,7 @@ QualifierAlignment: Left
# ReferenceAlignment: Pointer
# ReflowComments: true
# RemoveBracesLLVM: false
# RemoveParentheses: Leave
# RemoveSemicolon: false
# RequiresClausePosition: OwnLine
# RequiresExpressionIndentation: OuterScope
Expand All @@ -215,6 +219,7 @@ SpaceAfterTemplateKeyword: false
# SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true
# SpaceBeforeJsonColon: false
# SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
# AfterControlStatements: true
Expand All @@ -229,16 +234,18 @@ SpaceBeforeParensOptions:
# SpaceBeforeRangeBasedForLoopColon: true
# SpaceBeforeSquareBrackets: false
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 2
# SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
# SpacesInLineCommentPrefix:
# Minimum: 1
# Maximum: -1
# SpacesInParentheses: false
# SpacesInParens: Never
# SpacesInParensOptions:
# InCStyleCasts: false
# InConditionalStatements: false
# InEmptyParentheses: false
# Other: false
# SpacesInSquareBrackets: false
# Standard: Auto
# StatementAttributeLikeMacros:
Expand All @@ -248,6 +255,7 @@ SpaceBeforeParensOptions:
# - QT_REQUIRE_VERSION
# TabWidth: 8
# UseTab: Never
# VerilogBreakBetweenInstancePorts: true
# WhitespaceSensitiveMacros:
# - BOOST_PP_STRINGIZE
# - CF_SWIFT_NAME
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.3
hooks:
- id: clang-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
Expand Down
18 changes: 9 additions & 9 deletions src/core/include/mp-units/quantity.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class quantity {
}

template<typename Q>
friend constexpr decltype(auto) operator++(Q&& q)
friend constexpr decltype(auto) operator++(Q && q)
requires std::derived_from<std::remove_cvref_t<Q>, quantity> && requires(rep v) {
{
++v
Expand All @@ -274,7 +274,7 @@ class quantity {
}

template<typename Q>
friend constexpr decltype(auto) operator--(Q&& q)
friend constexpr decltype(auto) operator--(Q && q)
requires std::derived_from<std::remove_cvref_t<Q>, quantity> && requires(rep v) {
{
--v
Expand Down Expand Up @@ -302,7 +302,7 @@ class quantity {
a += b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator+=(Q&& lhs, const quantity& rhs)
friend constexpr decltype(auto) operator+=(Q && lhs, const quantity & rhs)
{
lhs.numerical_value_is_an_implementation_detail_ += rhs.numerical_value_is_an_implementation_detail_;
return std::forward<Q>(lhs);
Expand All @@ -314,7 +314,7 @@ class quantity {
a -= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator-=(Q&& lhs, const quantity& rhs)
friend constexpr decltype(auto) operator-=(Q && lhs, const quantity & rhs)
{
lhs.numerical_value_is_an_implementation_detail_ -= rhs.numerical_value_is_an_implementation_detail_;
return std::forward<Q>(lhs);
Expand All @@ -327,7 +327,7 @@ class quantity {
a %= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator%=(Q&& lhs, const quantity& rhs)
friend constexpr decltype(auto) operator%=(Q && lhs, const quantity & rhs)

{
gsl_ExpectsAudit(rhs != zero());
Expand All @@ -342,7 +342,7 @@ class quantity {
a *= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator*=(Q&& lhs, const Value& v)
friend constexpr decltype(auto) operator*=(Q && lhs, const Value & v)
{
lhs.numerical_value_is_an_implementation_detail_ *= v;
return std::forward<Q>(lhs);
Expand All @@ -355,7 +355,7 @@ class quantity {
a *= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator*=(Q1&& lhs, const Q2& rhs)
friend constexpr decltype(auto) operator*=(Q1 && lhs, const Q2 & rhs)
{
lhs.numerical_value_is_an_implementation_detail_ *= rhs.numerical_value_is_an_implementation_detail_;
return std::forward<Q1>(lhs);
Expand All @@ -368,7 +368,7 @@ class quantity {
a /= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator/=(Q&& lhs, const Value& v)
friend constexpr decltype(auto) operator/=(Q && lhs, const Value & v)
{
gsl_ExpectsAudit(v != quantity_values<Value>::zero());
lhs.numerical_value_is_an_implementation_detail_ /= v;
Expand All @@ -382,7 +382,7 @@ class quantity {
a /= b
} -> std::same_as<rep&>;
}
friend constexpr decltype(auto) operator/=(Q1&& lhs, const Q2& rhs)
friend constexpr decltype(auto) operator/=(Q1 && lhs, const Q2 & rhs)
{
gsl_ExpectsAudit(rhs != rhs.zero());
lhs.numerical_value_is_an_implementation_detail_ /= rhs.numerical_value_is_an_implementation_detail_;
Expand Down
8 changes: 4 additions & 4 deletions src/core/include/mp-units/quantity_point.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class quantity_point {

// member unary operators
template<typename QP>
friend constexpr decltype(auto) operator++(QP&& qp)
friend constexpr decltype(auto) operator++(QP && qp)
requires std::derived_from<std::remove_cvref_t<QP>, quantity_point> &&
requires { ++qp.quantity_from_origin_is_an_implementation_detail_; }
{
Expand All @@ -238,7 +238,7 @@ class quantity_point {
}

template<typename QP>
friend constexpr decltype(auto) operator--(QP&& qp)
friend constexpr decltype(auto) operator--(QP && qp)
requires std::derived_from<std::remove_cvref_t<QP>, quantity_point> &&
requires { --qp.quantity_from_origin_is_an_implementation_detail_; }
{
Expand All @@ -256,7 +256,7 @@ class quantity_point {
template<typename QP>
requires std::derived_from<std::remove_cvref_t<QP>, quantity_point> &&
requires(quantity_type q) { quantity_from_origin_is_an_implementation_detail_ += q; }
friend constexpr decltype(auto) operator+=(QP&& qp, const quantity_type& q)
friend constexpr decltype(auto) operator+=(QP && qp, const quantity_type & q)
{
qp.quantity_from_origin_is_an_implementation_detail_ += q;
return std::forward<QP>(qp);
Expand All @@ -265,7 +265,7 @@ class quantity_point {
template<typename QP>
requires std::derived_from<std::remove_cvref_t<QP>, quantity_point> &&
requires(quantity_type q) { quantity_from_origin_is_an_implementation_detail_ -= q; }
friend constexpr decltype(auto) operator-=(QP&& qp, const quantity_type& q)
friend constexpr decltype(auto) operator-=(QP && qp, const quantity_type & q)
{
qp.quantity_from_origin_is_an_implementation_detail_ -= q;
return std::forward<QP>(qp);
Expand Down

0 comments on commit 1f14184

Please sign in to comment.