clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: If096f669adeff92c41d6c8ea00c972ad35467e47
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d92a3f1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -14,26 +14,30 @@
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
+BitFieldColonSpacing: None
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
+ AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
- AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
+ BeforeLambdaBody: false
+ BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
@@ -48,17 +52,16 @@
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DeriveLineEnding: false
DerivePointerAlignment: false
-PointerAlignment: Left
DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
@@ -78,6 +81,7 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentExternBlock: NoIndent
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -92,6 +96,7 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
@@ -100,12 +105,13 @@
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: Keyword
-SortIncludes: true
+SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
@@ -117,7 +123,7 @@
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
diff --git a/include/stdplus/exception.hpp b/include/stdplus/exception.hpp
index a3b9866..6fe4d47 100644
--- a/include/stdplus/exception.hpp
+++ b/include/stdplus/exception.hpp
@@ -46,7 +46,7 @@
{
return Ret();
}
- };
+ };
}
template <typename F>
diff --git a/include/stdplus/function_view.hpp b/include/stdplus/function_view.hpp
index dc8287c..21d0c81 100644
--- a/include/stdplus/function_view.hpp
+++ b/include/stdplus/function_view.hpp
@@ -74,18 +74,17 @@
requires(!C && std::same_as<std::invoke_result_t<F, Args...>, R>)
inline function_view_base(F& f) noexcept :
memfun([](void* v, Args... args) {
- return (*reinterpret_cast<F*>(v))(std::forward<Args>(args)...);
- }),
+ return (*reinterpret_cast<F*>(v))(std::forward<Args>(args)...);
+ }),
obj(std::addressof(f))
{}
template <std::invocable<Args...> F>
requires std::same_as<std::invoke_result_t<F, Args...>, R>
inline function_view_base(const F& f) noexcept :
- memfun(
- [](void* v, Args... args) {
+ memfun([](void* v, Args... args) {
return (*reinterpret_cast<const F*>(v))(std::forward<Args>(args)...);
- }),
+ }),
obj(const_cast<F*>(std::addressof(f)))
{}
diff --git a/include/stdplus/handle/managed.hpp b/include/stdplus/handle/managed.hpp
index 1d4eceb..449c377 100644
--- a/include/stdplus/handle/managed.hpp
+++ b/include/stdplus/handle/managed.hpp
@@ -62,8 +62,8 @@
HandleF& operator=(const HandleF& other) = delete;
constexpr HandleF(HandleF&& other) noexcept(
- std::is_nothrow_move_constructible_v<std::tuple<As...>>&&
- std::is_nothrow_move_constructible_v<std::optional<T>>) :
+ std::is_nothrow_move_constructible_v<std::tuple<As...>> &&
+ std::is_nothrow_move_constructible_v<std::optional<T>>) :
as(std::move(other.as)),
maybeT(std::move(other.maybeT))
{
@@ -85,9 +85,9 @@
}
virtual ~HandleF() noexcept(
- std::is_nothrow_destructible_v<std::tuple<As...>>&&
- std::is_nothrow_destructible_v<std::optional<T>>&& noexcept(
- std::declval<HandleF>().reset()))
+ std::is_nothrow_destructible_v<std::tuple<As...>> &&
+ std::is_nothrow_destructible_v<std::optional<T>>&& noexcept(
+ std::declval<HandleF>().reset()))
{
reset();
}
@@ -154,13 +154,15 @@
* @param[in] maybeV - Maybe the new value
*/
constexpr void reset(std::optional<T>&& maybeV) noexcept(
- drop_noexcept&& std::is_nothrow_move_assignable_v<std::optional<T>>)
+ drop_noexcept &&
+ std::is_nothrow_move_assignable_v<std::optional<T>>)
{
maybeDrop(std::index_sequence_for<As...>());
maybeT = std::move(maybeV);
}
constexpr void reset(T&& maybeV) noexcept(
- drop_noexcept&& std::is_nothrow_move_assignable_v<std::optional<T>>)
+ drop_noexcept &&
+ std::is_nothrow_move_assignable_v<std::optional<T>>)
{
maybeDrop(std::index_sequence_for<As...>());
maybeT = std::move(maybeV);
diff --git a/include/stdplus/util/cexec.hpp b/include/stdplus/util/cexec.hpp
index 5a0de16..f05f445 100644
--- a/include/stdplus/util/cexec.hpp
+++ b/include/stdplus/util/cexec.hpp
@@ -54,7 +54,7 @@
"Unimplemented check routine"); \
} \
return check_errno_ret; \
- }((expr))
+ }((expr))
/** @brief Wraps common c style error handling for exception throwing
* This requires the callee to provide error information in -r.
@@ -78,7 +78,7 @@
"Unimplemented check routine"); \
} \
return check_ret_ret; \
- }((expr))
+ }((expr))
namespace stdplus
{
diff --git a/include/stdplus/variant.hpp b/include/stdplus/variant.hpp
index fe849da..8a1f3e9 100644
--- a/include/stdplus/variant.hpp
+++ b/include/stdplus/variant.hpp
@@ -78,7 +78,7 @@
return std::visit(
[&t](const auto& v) {
return Veq<std::remove_cvref_t<decltype(v)>, T>{}(v, t);
- },
+ },
vs);
}