clang-format: copy latest and re-format
clang-format-16 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: I6bbb587615b9d6f158900201ca04a647cb3a8f96
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/include/stdplus/cancel.hpp b/include/stdplus/cancel.hpp
index b8bc82d..3017e1b 100644
--- a/include/stdplus/cancel.hpp
+++ b/include/stdplus/cancel.hpp
@@ -30,24 +30,19 @@
struct Cancel : detail::CancelHandle
{
- Cancel() : detail::CancelHandle(std::nullopt)
- {
- }
+ Cancel() : detail::CancelHandle(std::nullopt) {}
template <typename T>
explicit Cancel(T&& t) : detail::CancelHandle(t)
- {
- }
+ {}
};
namespace detail
{
struct fAny
-{
-};
+{};
struct fPtr : fAny
-{
-};
+{};
template <typename>
struct validator
@@ -83,14 +78,12 @@
template <typename Fi, typename... Vs>
explicit AlwaysCallOnce(Fi&& fi, Vs&&... default_args) :
f(std::forward<Fi>(fi)), default_args(std::forward<Vs>(default_args)...)
- {
- }
+ {}
AlwaysCallOnce(const AlwaysCallOnce&) = delete;
AlwaysCallOnce(AlwaysCallOnce&& other) noexcept :
f(std::move(other.f)), default_args(std::move(other.default_args)),
called(std::exchange(other.called, true))
- {
- }
+ {}
AlwaysCallOnce& operator=(const AlwaysCallOnce&) = delete;
AlwaysCallOnce& operator=(AlwaysCallOnce&& other) noexcept
{
diff --git a/include/stdplus/exception.hpp b/include/stdplus/exception.hpp
index 5390320..059f17f 100644
--- a/include/stdplus/exception.hpp
+++ b/include/stdplus/exception.hpp
@@ -1,5 +1,6 @@
#pragma once
#include <fmt/format.h>
+
#include <source_location>
#include <system_error>
#include <utility>
@@ -40,25 +41,25 @@
{
return
[f = std::move(f), file, line, func](auto&&... args) mutable noexcept {
- try
- {
- return f(std::forward<decltype(args)>(args)...);
- }
- catch (const std::exception& e)
- {
- fmt::print(stderr, "Ignoring({}:{} {}): {}\n", file, line, func,
- e.what());
- }
- catch (...)
- {
- fmt::print(stderr, "Ignoring({}:{} {}): Invalid Error\n", file,
- line, func);
- }
- using Ret = std::invoke_result_t<decltype(f), decltype(args)...>;
- if constexpr (!std::is_same_v<void, Ret>)
- {
- return Ret();
- }
+ try
+ {
+ return f(std::forward<decltype(args)>(args)...);
+ }
+ catch (const std::exception& e)
+ {
+ fmt::print(stderr, "Ignoring({}:{} {}): {}\n", file, line, func,
+ e.what());
+ }
+ catch (...)
+ {
+ fmt::print(stderr, "Ignoring({}:{} {}): Invalid Error\n", file,
+ line, func);
+ }
+ using Ret = std::invoke_result_t<decltype(f), decltype(args)...>;
+ if constexpr (!std::is_same_v<void, Ret>)
+ {
+ return Ret();
+ }
};
}
@@ -79,8 +80,7 @@
return f(std::forward<decltype(args)>(args)...);
}
catch (...)
- {
- }
+ {}
using Ret = std::invoke_result_t<decltype(f), decltype(args)...>;
if constexpr (!std::is_same_v<void, Ret>)
{
diff --git a/include/stdplus/flags.hpp b/include/stdplus/flags.hpp
index 047c776..a5678f3 100644
--- a/include/stdplus/flags.hpp
+++ b/include/stdplus/flags.hpp
@@ -8,9 +8,7 @@
class BitFlags
{
public:
- inline explicit BitFlags(Int val = 0) noexcept : val(val)
- {
- }
+ inline explicit BitFlags(Int val = 0) noexcept : val(val) {}
inline BitFlags& set(Flag flag) & noexcept
{
diff --git a/include/stdplus/handle/copyable.hpp b/include/stdplus/handle/copyable.hpp
index 86fc8b7..c40b432 100644
--- a/include/stdplus/handle/copyable.hpp
+++ b/include/stdplus/handle/copyable.hpp
@@ -1,6 +1,7 @@
#pragma once
-#include <optional>
#include <stdplus/handle/managed.hpp>
+
+#include <optional>
#include <type_traits>
#include <utility>
@@ -57,14 +58,12 @@
T>&&>(),
std::declval<Vs>()...))) :
MHandleF(std::move(maybeV), std::forward<Vs>(vs)...)
- {
- }
+ {}
template <typename... Vs>
constexpr explicit HandleF(T&& maybeV, Vs&&... vs) noexcept(
noexcept(MHandleF(std::declval<T&&>(), std::declval<Vs>()...))) :
MHandleF(std::move(maybeV), std::forward<Vs>(vs)...)
- {
- }
+ {}
constexpr HandleF(const HandleF& other) noexcept(noexcept(MHandleF(
std::nullopt,
@@ -81,8 +80,7 @@
constexpr HandleF(HandleF&& other) noexcept(
std::is_nothrow_move_constructible_v<MHandleF>) :
MHandleF(std::move(other))
- {
- }
+ {}
constexpr HandleF& operator=(const HandleF& other) noexcept(
noexcept(std::declval<HandleF>().reset()) &&
diff --git a/include/stdplus/handle/managed.hpp b/include/stdplus/handle/managed.hpp
index 08cac4f..1d4eceb 100644
--- a/include/stdplus/handle/managed.hpp
+++ b/include/stdplus/handle/managed.hpp
@@ -31,7 +31,6 @@
template <typename T, typename... As>
struct Managed
{
-
template <typename Drop>
class HandleF
{
@@ -50,16 +49,14 @@
std::tuple<As...>(std::declval<Vs>()...))) :
as(std::forward<Vs>(vs)...),
maybeT(std::move(maybeV))
- {
- }
+ {}
template <typename... Vs>
constexpr explicit HandleF(T&& maybeV, Vs&&... vs) noexcept(
std::is_nothrow_move_constructible_v<std::optional<T>>&& noexcept(
std::tuple<As...>(std::declval<Vs>()...))) :
as(std::forward<Vs>(vs)...),
maybeT(std::move(maybeV))
- {
- }
+ {}
HandleF(const HandleF& other) = delete;
HandleF& operator=(const HandleF& other) = delete;
diff --git a/include/stdplus/pinned.hpp b/include/stdplus/pinned.hpp
index c1490b2..e52a57f 100644
--- a/include/stdplus/pinned.hpp
+++ b/include/stdplus/pinned.hpp
@@ -49,8 +49,7 @@
constexpr Pinned(Args&&... args) noexcept(
noexcept(CT(std::declval<Args>()...))) :
CT(std::forward<Args>(args)...)
- {
- }
+ {}
template <typename Arg>
constexpr Pinned& operator=(Arg&& arg) noexcept(
@@ -76,24 +75,20 @@
!std::is_move_assignable_v<std::remove_cvref_t<U>>,
bool> = true>
constexpr PinnedRef(U& u) noexcept : wrapper(u)
- {
- }
+ {}
template <typename U>
constexpr PinnedRef(Pinned<U>& u) noexcept : wrapper(u)
- {
- }
+ {}
template <typename U,
std::enable_if_t<!std::is_same_v<U, void> && std::is_const_v<T>,
bool> = true>
constexpr PinnedRef(const Pinned<U>& u) noexcept : wrapper(u)
- {
- }
+ {}
template <typename U>
constexpr PinnedRef(PinnedRef<U> u) noexcept : wrapper(u)
- {
- }
+ {}
};
template <typename T>
diff --git a/include/stdplus/raw.hpp b/include/stdplus/raw.hpp
index a5206c0..dbec33e 100644
--- a/include/stdplus/raw.hpp
+++ b/include/stdplus/raw.hpp
@@ -1,6 +1,7 @@
#pragma once
-#include <algorithm>
#include <fmt/format.h>
+
+#include <algorithm>
#include <span>
#include <stdexcept>
#include <string_view>
@@ -94,11 +95,9 @@
/** @brief If you can guarantee the underlying data is properly aligned
* for raw struct access this specifier is used to override compile checks. */
struct Aligned
-{
-};
+{};
struct UnAligned
-{
-};
+{};
/** @brief References the data from a buffer if aligned
*
diff --git a/include/stdplus/str/cat.hpp b/include/stdplus/str/cat.hpp
index 3c39df0..fc97b17 100644
--- a/include/stdplus/str/cat.hpp
+++ b/include/stdplus/str/cat.hpp
@@ -23,8 +23,7 @@
template <typename... Args>
constexpr DedSV(Args&&... args) :
std::basic_string_view<CharT, Traits>(std::forward<Args>(args)...)
- {
- }
+ {}
};
template <typename CharT>
diff --git a/include/stdplus/util/cexec.hpp b/include/stdplus/util/cexec.hpp
index daf402c..a40903e 100644
--- a/include/stdplus/util/cexec.hpp
+++ b/include/stdplus/util/cexec.hpp
@@ -53,7 +53,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.
@@ -77,7 +77,7 @@
"Unimplemented check routine"); \
} \
return check_ret_ret; \
- }((expr))
+ }((expr))
namespace stdplus
{
@@ -156,7 +156,7 @@
* @throws std::system_error for an error case.
* @return A successful return value based on the function type
*/
-template <auto(*makeError)(int, const char*) = makeSystemError,
+template <auto (*makeError)(int, const char*) = makeSystemError,
typename... Args>
inline auto callCheckErrno(const char* msg, Args&&... args)
{
@@ -181,7 +181,7 @@
static_assert(std::is_same_v<Ret, int>, "Unimplemented check routine");
}
}
-template <auto(*makeError)(int, const char*) = makeSystemError,
+template <auto (*makeError)(int, const char*) = makeSystemError,
typename... Args>
inline auto callCheckErrno(const std::string& msg, Args&&... args)
{
@@ -198,7 +198,7 @@
* @throws std::system_error for an error case.
* @return A successful return value based on the function type
*/
-template <auto(*makeError)(int, const char*) = makeSystemError,
+template <auto (*makeError)(int, const char*) = makeSystemError,
typename... Args>
inline auto callCheckRet(const char* msg, Args&&... args)
{
@@ -216,7 +216,7 @@
static_assert(std::is_same_v<Ret, int>, "Unimplemented check routine");
}
}
-template <auto(*makeError)(int, const char*) = makeSystemError,
+template <auto (*makeError)(int, const char*) = makeSystemError,
typename... Args>
inline auto callCheckRet(const std::string& msg, Args&&... args)
{
diff --git a/include/stdplus/zstring.hpp b/include/stdplus/zstring.hpp
index 694eeaf..29288ae 100644
--- a/include/stdplus/zstring.hpp
+++ b/include/stdplus/zstring.hpp
@@ -1,6 +1,7 @@
#pragma once
-#include <cstddef>
#include <fmt/core.h>
+
+#include <cstddef>
#include <limits>
#include <string>
#include <type_traits>
@@ -50,14 +51,12 @@
template <typename T, typename CharT, typename Traits>
struct same_string : std::false_type
-{
-};
+{};
template <typename CharT, typename Traits, typename Allocator>
-struct same_string<std::basic_string<CharT, Traits, Allocator>, CharT, Traits>
- : std::true_type
-{
-};
+struct same_string<std::basic_string<CharT, Traits, Allocator>, CharT, Traits> :
+ std::true_type
+{};
} // namespace detail
@@ -97,8 +96,7 @@
}
template <typename T, std::enable_if_t<std::is_pointer_v<T>, bool> = true>
constexpr basic_zstring(T str) noexcept : data_(str)
- {
- }
+ {}
template <typename T,
std::enable_if_t<detail::same_string<std::remove_cvref_t<T>,
decay_t, Traits>::value,
@@ -254,8 +252,8 @@
template <typename CharT, typename Traits>
struct formatter<stdplus::basic_zstring<CharT, Traits>,
- std::remove_const_t<CharT>>
- : formatter<const CharT*, std::remove_const_t<CharT>>
+ std::remove_const_t<CharT>> :
+ formatter<const CharT*, std::remove_const_t<CharT>>
{
template <typename FormatContext>
inline auto format(stdplus::basic_zstring<CharT, Traits> str,
diff --git a/include/stdplus/zstring_view.hpp b/include/stdplus/zstring_view.hpp
index 3ae13b3..a346130 100644
--- a/include/stdplus/zstring_view.hpp
+++ b/include/stdplus/zstring_view.hpp
@@ -1,7 +1,9 @@
#pragma once
#include <fmt/core.h>
-#include <stdexcept>
+
#include <stdplus/zstring.hpp>
+
+#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
@@ -83,12 +85,10 @@
:
sv(str, detail::zstring_validate(str, 0, N))
#endif
- {
- }
+ {}
template <typename T, std::enable_if_t<std::is_pointer_v<T>, bool> = true>
constexpr basic_zstring_view(T str) noexcept : sv(str)
- {
- }
+ {}
template <typename T,
std::enable_if_t<detail::same_string<T, CharT, Traits>::value,
bool> = true>
@@ -101,16 +101,14 @@
sv(str.data(),
detail::zstring_validate(str.data(), str.size(), str.size() + 1))
#endif
- {
- }
+ {}
template <
typename T,
std::enable_if_t<std::is_same_v<value_type, std::remove_const_t<T>>,
bool> = true>
constexpr basic_zstring_view(basic_zstring<T, Traits> str) noexcept :
sv(str.data())
- {
- }
+ {}
constexpr operator string_view_base() const noexcept
{
@@ -295,11 +293,9 @@
string_view_base sv;
struct unsafe
- {
- };
+ {};
constexpr basic_zstring_view(unsafe, string_view_base sv) noexcept : sv(sv)
- {
- }
+ {}
friend auto detail::unsafe_zstring_view<CharT, Traits>(string_view_base sv);
};
@@ -331,10 +327,9 @@
namespace std \
{ \
template <> \
- struct hash<stdplus::basic_zstring_view<char_t>> \
- : hash<basic_string_view<char_t>> \
- { \
- }; \
+ struct hash<stdplus::basic_zstring_view<char_t>> : \
+ hash<basic_string_view<char_t>> \
+ {}; \
}
zstring_view_all(char, );
zstring_view_all(char8_t, u8);
@@ -347,8 +342,8 @@
{
template <typename CharT, typename Traits>
-struct formatter<stdplus::basic_zstring_view<CharT, Traits>, CharT>
- : formatter<basic_string_view<CharT>, CharT>
+struct formatter<stdplus::basic_zstring_view<CharT, Traits>, CharT> :
+ formatter<basic_string_view<CharT>, CharT>
{
template <typename FormatContext>
inline auto format(stdplus::basic_zstring_view<CharT, Traits> str,