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: I84a952aae0e96b2960d8622659902df660d5ddb8
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 9109e65..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,22 +5,24 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,29 +31,60 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
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 ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 7
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.h"'
+ Priority: 1
+ - Regex: '^".*\.hpp"'
+ Priority: 2
+ - Regex: '^<.*\.h>'
+ Priority: 3
+ - Regex: '^<.*\.hpp>'
+ Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -59,18 +92,29 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -78,7 +122,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/example/delayed_echo.cpp b/example/delayed_echo.cpp
index db90523..1b700d0 100644
--- a/example/delayed_echo.cpp
+++ b/example/delayed_echo.cpp
@@ -3,15 +3,17 @@
* is calm for the passed in number of seconds.
*/
-#include <array>
-#include <chrono>
-#include <cstdio>
+#include <unistd.h>
+
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/io.hpp>
#include <sdeventplus/utility/timer.hpp>
+
+#include <array>
+#include <chrono>
+#include <cstdio>
#include <string>
-#include <unistd.h>
#include <utility>
using sdeventplus::Clock;
diff --git a/example/follow.cpp b/example/follow.cpp
index 7f72687..0a19eb4 100644
--- a/example/follow.cpp
+++ b/example/follow.cpp
@@ -1,19 +1,21 @@
-#include <cerrno>
-#include <cstdio>
-#include <cstring>
-#include <exception>
#include <fcntl.h>
-#include <functional>
-#include <sdeventplus/event.hpp>
-#include <sdeventplus/source/event.hpp>
-#include <sdeventplus/source/io.hpp>
-#include <sdeventplus/source/signal.hpp>
#include <signal.h>
#include <sys/epoll.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <sdeventplus/event.hpp>
+#include <sdeventplus/source/event.hpp>
+#include <sdeventplus/source/io.hpp>
+#include <sdeventplus/source/signal.hpp>
+
+#include <cerrno>
+#include <cstdio>
+#include <cstring>
+#include <exception>
+#include <functional>
+
void reader(const char* fifo, sdeventplus::source::IO& source, int fd, uint32_t)
{
char buf[4096];
diff --git a/example/heartbeat.cpp b/example/heartbeat.cpp
index 4a1374a..b957339 100644
--- a/example/heartbeat.cpp
+++ b/example/heartbeat.cpp
@@ -1,10 +1,11 @@
-#include <chrono>
-#include <cstdio>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/signal.hpp>
#include <sdeventplus/source/time.hpp>
#include <stdplus/signal.hpp>
+
+#include <chrono>
+#include <cstdio>
#include <string>
#include <utility>
diff --git a/example/heartbeat_timer.cpp b/example/heartbeat_timer.cpp
index d9203ac..04c0ba8 100644
--- a/example/heartbeat_timer.cpp
+++ b/example/heartbeat_timer.cpp
@@ -3,14 +3,15 @@
* each timer expiration.
*/
-#include <chrono>
-#include <cstdio>
-#include <functional>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/signal.hpp>
#include <sdeventplus/utility/timer.hpp>
#include <stdplus/signal.hpp>
+
+#include <chrono>
+#include <cstdio>
+#include <functional>
#include <string>
using sdeventplus::Clock;
diff --git a/src/sdeventplus/clock.cpp b/src/sdeventplus/clock.cpp
index ff468ee..7efd08b 100644
--- a/src/sdeventplus/clock.cpp
+++ b/src/sdeventplus/clock.cpp
@@ -2,6 +2,7 @@
#include <sdeventplus/exception.hpp>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
+
#include <utility>
namespace sdeventplus
@@ -9,13 +10,11 @@
template <ClockId Id>
Clock<Id>::Clock(const Event& event) : event(event)
-{
-}
+{}
template <ClockId Id>
Clock<Id>::Clock(Event&& event) : event(std::move(event))
-{
-}
+{}
template <ClockId Id>
typename Clock<Id>::time_point Clock<Id>::now() const
diff --git a/src/sdeventplus/clock.hpp b/src/sdeventplus/clock.hpp
index a25b6ba..aaf56bc 100644
--- a/src/sdeventplus/clock.hpp
+++ b/src/sdeventplus/clock.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include <sdeventplus/event.hpp>
+#include <sdeventplus/types.hpp>
+
#include <chrono>
#include <cstdint>
#include <ctime>
-#include <sdeventplus/event.hpp>
-#include <sdeventplus/types.hpp>
#include <type_traits>
namespace sdeventplus
diff --git a/src/sdeventplus/event.cpp b/src/sdeventplus/event.cpp
index 56891b5..0c9d0d9 100644
--- a/src/sdeventplus/event.cpp
+++ b/src/sdeventplus/event.cpp
@@ -1,8 +1,10 @@
-#include <functional>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
-#include <systemd/sd-event.h>
+
+#include <functional>
#include <type_traits>
#include <utility>
@@ -11,20 +13,17 @@
Event::Event(sd_event* event, const internal::SdEvent* sdevent) :
sdevent(sdevent), event(event, sdevent, true)
-{
-}
+{}
Event::Event(sd_event* event, std::false_type,
const internal::SdEvent* sdevent) :
sdevent(sdevent),
event(std::move(event), sdevent, true)
-{
-}
+{}
Event::Event(const Event& other, sdeventplus::internal::NoOwn) :
sdevent(other.sdevent), event(other.get(), other.getSdEvent(), false)
-{
-}
+{}
Event Event::get_new(const internal::SdEvent* sdevent)
{
diff --git a/src/sdeventplus/event.hpp b/src/sdeventplus/event.hpp
index 02c1750..8b3e9ce 100644
--- a/src/sdeventplus/event.hpp
+++ b/src/sdeventplus/event.hpp
@@ -1,10 +1,12 @@
#pragma once
-#include <optional>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/types.hpp>
#include <stdplus/handle/copyable.hpp>
-#include <systemd/sd-event.h>
+
+#include <optional>
namespace sdeventplus
{
diff --git a/src/sdeventplus/exception.cpp b/src/sdeventplus/exception.cpp
index 9e8b7de..897ee99 100644
--- a/src/sdeventplus/exception.cpp
+++ b/src/sdeventplus/exception.cpp
@@ -1,4 +1,5 @@
#include <sdeventplus/exception.hpp>
+
#include <system_error>
namespace sdeventplus
@@ -6,7 +7,6 @@
SdEventError::SdEventError(int r, const char* prefix) :
std::system_error(r, std::generic_category(), prefix)
-{
-}
+{}
} // namespace sdeventplus
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index 33e22aa..f3bdeb3 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -1,6 +1,7 @@
-#include <sdeventplus/internal/sdevent.hpp>
#include <systemd/sd-event.h>
+#include <sdeventplus/internal/sdevent.hpp>
+
namespace sdeventplus
{
namespace internal
diff --git a/src/sdeventplus/source/base.cpp b/src/sdeventplus/source/base.cpp
index 70cb527..4975d69 100644
--- a/src/sdeventplus/source/base.cpp
+++ b/src/sdeventplus/source/base.cpp
@@ -1,8 +1,9 @@
-#include <functional>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/types.hpp>
+
+#include <functional>
#include <utility>
namespace sdeventplus
@@ -107,14 +108,12 @@
Base::Base(const Event& event, sd_event_source* source, std::false_type) :
event(event), source(std::move(source), event.getSdEvent(), true)
-{
-}
+{}
Base::Base(const Base& other, sdeventplus::internal::NoOwn) :
event(other.get_event(), sdeventplus::internal::NoOwn()),
source(other.get(), event.getSdEvent(), false)
-{
-}
+{}
void Base::set_userdata(std::unique_ptr<detail::BaseData> data) const
{
@@ -167,8 +166,7 @@
BaseData::BaseData(const Base& base) :
Base(base, sdeventplus::internal::NoOwn())
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/source/base.hpp b/src/sdeventplus/source/base.hpp
index 914cf36..607ee14 100644
--- a/src/sdeventplus/source/base.hpp
+++ b/src/sdeventplus/source/base.hpp
@@ -1,15 +1,17 @@
#pragma once
-#include <cerrno>
-#include <cstdint>
-#include <cstdio>
+#include <systemd/sd-bus.h>
+
#include <function2/function2.hpp>
-#include <functional>
-#include <memory>
#include <sdeventplus/event.hpp>
#include <sdeventplus/types.hpp>
#include <stdplus/handle/copyable.hpp>
-#include <systemd/sd-bus.h>
+
+#include <cerrno>
+#include <cstdint>
+#include <cstdio>
+#include <functional>
+#include <memory>
#include <type_traits>
#include <utility>
diff --git a/src/sdeventplus/source/child.cpp b/src/sdeventplus/source/child.cpp
index d89d062..be17fa1 100644
--- a/src/sdeventplus/source/child.cpp
+++ b/src/sdeventplus/source/child.cpp
@@ -1,8 +1,9 @@
-#include <memory>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/child.hpp>
#include <sdeventplus/types.hpp>
+
+#include <memory>
#include <type_traits>
#include <utility>
@@ -20,8 +21,7 @@
Child::Child(const Child& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
-{
-}
+{}
void Child::set_callback(Callback&& callback)
{
@@ -71,8 +71,7 @@
ChildData::ChildData(const Child& base, Child::Callback&& callback) :
Child(base, sdeventplus::internal::NoOwn()), BaseData(base),
callback(std::move(callback))
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/source/child.hpp b/src/sdeventplus/source/child.hpp
index 7022a3c..149273f 100644
--- a/src/sdeventplus/source/child.hpp
+++ b/src/sdeventplus/source/child.hpp
@@ -1,9 +1,10 @@
#pragma once
+#include <signal.h>
+
#include <function2/function2.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/types.hpp>
-#include <signal.h>
namespace sdeventplus
{
diff --git a/src/sdeventplus/source/event.cpp b/src/sdeventplus/source/event.cpp
index a7a49fc..64601ca 100644
--- a/src/sdeventplus/source/event.cpp
+++ b/src/sdeventplus/source/event.cpp
@@ -1,8 +1,9 @@
-#include <memory>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/event.hpp>
#include <sdeventplus/types.hpp>
+
+#include <memory>
#include <utility>
namespace sdeventplus
@@ -17,8 +18,7 @@
EventBase::EventBase(const EventBase& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
-{
-}
+{}
EventBase::EventBase(const char* name, CreateFunc create, const Event& event,
Callback&& callback) :
@@ -61,28 +61,24 @@
EventBase::Callback&& callback) :
EventBase(base, sdeventplus::internal::NoOwn()),
BaseData(base), callback(std::move(callback))
-{
-}
+{}
} // namespace detail
Defer::Defer(const Event& event, Callback&& callback) :
EventBase("sd_event_add_defer", &internal::SdEvent::sd_event_add_defer,
event, std::move(callback))
-{
-}
+{}
Post::Post(const Event& event, Callback&& callback) :
EventBase("sd_event_add_post", &internal::SdEvent::sd_event_add_post, event,
std::move(callback))
-{
-}
+{}
Exit::Exit(const Event& event, Callback&& callback) :
EventBase("sd_event_add_exit", &internal::SdEvent::sd_event_add_exit, event,
std::move(callback))
-{
-}
+{}
} // namespace source
} // namespace sdeventplus
diff --git a/src/sdeventplus/source/event.hpp b/src/sdeventplus/source/event.hpp
index 60b1252..f93972d 100644
--- a/src/sdeventplus/source/event.hpp
+++ b/src/sdeventplus/source/event.hpp
@@ -1,10 +1,12 @@
#pragma once
+#include <systemd/sd-event.h>
+
#include <function2/function2.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/types.hpp>
-#include <systemd/sd-event.h>
+
#include <type_traits>
namespace sdeventplus
diff --git a/src/sdeventplus/source/io.cpp b/src/sdeventplus/source/io.cpp
index 2723ca1..5b58253 100644
--- a/src/sdeventplus/source/io.cpp
+++ b/src/sdeventplus/source/io.cpp
@@ -2,6 +2,7 @@
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/io.hpp>
#include <sdeventplus/types.hpp>
+
#include <type_traits>
#include <utility>
@@ -18,8 +19,7 @@
IO::IO(const IO& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
-{
-}
+{}
void IO::set_callback(Callback&& callback)
{
@@ -96,8 +96,7 @@
IOData::IOData(const IO& base, IO::Callback&& callback) :
IO(base, sdeventplus::internal::NoOwn()), BaseData(base),
callback(std::move(callback))
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/source/io.hpp b/src/sdeventplus/source/io.hpp
index ebb9e34..7fc54e6 100644
--- a/src/sdeventplus/source/io.hpp
+++ b/src/sdeventplus/source/io.hpp
@@ -1,9 +1,11 @@
#pragma once
-#include <cstdint>
+#include <systemd/sd-event.h>
+
#include <function2/function2.hpp>
#include <sdeventplus/source/base.hpp>
-#include <systemd/sd-event.h>
+
+#include <cstdint>
#include <type_traits>
namespace sdeventplus
diff --git a/src/sdeventplus/source/signal.cpp b/src/sdeventplus/source/signal.cpp
index 283b86f..441321e 100644
--- a/src/sdeventplus/source/signal.cpp
+++ b/src/sdeventplus/source/signal.cpp
@@ -1,8 +1,9 @@
-#include <memory>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/signal.hpp>
#include <sdeventplus/types.hpp>
+
+#include <memory>
#include <type_traits>
#include <utility>
@@ -20,8 +21,7 @@
Signal::Signal(const Signal& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
-{
-}
+{}
void Signal::set_callback(Callback&& callback)
{
@@ -67,8 +67,7 @@
SignalData::SignalData(const Signal& base, Signal::Callback&& callback) :
Signal(base, sdeventplus::internal::NoOwn()), BaseData(base),
callback(std::move(callback))
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/source/signal.hpp b/src/sdeventplus/source/signal.hpp
index d5035d1..8ae9c62 100644
--- a/src/sdeventplus/source/signal.hpp
+++ b/src/sdeventplus/source/signal.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include <sys/signalfd.h>
+
#include <function2/function2.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/types.hpp>
-#include <sys/signalfd.h>
namespace sdeventplus
{
diff --git a/src/sdeventplus/source/time.cpp b/src/sdeventplus/source/time.cpp
index 9eb7a7a..956bd67 100644
--- a/src/sdeventplus/source/time.cpp
+++ b/src/sdeventplus/source/time.cpp
@@ -1,9 +1,10 @@
-#include <memory>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/internal/cexec.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/time.hpp>
#include <sdeventplus/types.hpp>
+
+#include <memory>
#include <type_traits>
#include <utility>
@@ -24,8 +25,7 @@
template <ClockId Id>
Time<Id>::Time(const Time<Id>& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
-{
-}
+{}
template <ClockId Id>
void Time<Id>::set_callback(Callback&& callback)
@@ -118,8 +118,7 @@
typename Time<Id>::Callback&& callback) :
Time<Id>(base, sdeventplus::internal::NoOwn()),
BaseData(base), callback(std::move(callback))
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/source/time.hpp b/src/sdeventplus/source/time.hpp
index e606411..2f6097f 100644
--- a/src/sdeventplus/source/time.hpp
+++ b/src/sdeventplus/source/time.hpp
@@ -1,11 +1,13 @@
#pragma once
-#include <cstdint>
+#include <systemd/sd-event.h>
+
#include <function2/function2.hpp>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/types.hpp>
-#include <systemd/sd-event.h>
+
+#include <cstdint>
namespace sdeventplus
{
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 13411e8..fd64e89 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -1,9 +1,11 @@
#pragma once
-#include <gmock/gmock.h>
-#include <sdeventplus/internal/sdevent.hpp>
#include <systemd/sd-event.h>
+#include <sdeventplus/internal/sdevent.hpp>
+
+#include <gmock/gmock.h>
+
namespace sdeventplus
{
namespace test
diff --git a/src/sdeventplus/types.hpp b/src/sdeventplus/types.hpp
index 2654f2e..39717c0 100644
--- a/src/sdeventplus/types.hpp
+++ b/src/sdeventplus/types.hpp
@@ -15,8 +15,7 @@
/* @brief Indicates that the container should not own the underlying
* sd_event primative */
struct NoOwn
-{
-};
+{};
} // namespace internal
} // namespace sdeventplus
diff --git a/src/sdeventplus/utility/sdbus.hpp b/src/sdeventplus/utility/sdbus.hpp
index bd4c5ce..6bbf2cf 100644
--- a/src/sdeventplus/utility/sdbus.hpp
+++ b/src/sdeventplus/utility/sdbus.hpp
@@ -1,6 +1,7 @@
#include <sdbusplus/bus.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
+
#include <stdexcept>
namespace sdeventplus::utility
diff --git a/src/sdeventplus/utility/timer.cpp b/src/sdeventplus/utility/timer.cpp
index 9dcde82..5398cec 100644
--- a/src/sdeventplus/utility/timer.cpp
+++ b/src/sdeventplus/utility/timer.cpp
@@ -1,7 +1,8 @@
-#include <memory>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/types.hpp>
#include <sdeventplus/utility/timer.hpp>
+
+#include <memory>
#include <stdexcept>
#include <utility>
@@ -35,8 +36,7 @@
Timer<Id>::Timer(const Timer<Id>& other, sdeventplus::internal::NoOwn) :
userdata(other.userdata),
timeSource(other.timeSource, sdeventplus::internal::NoOwn())
-{
-}
+{}
template <ClockId Id>
void Timer<Id>::set_callback(Callback&& callback)
@@ -194,8 +194,7 @@
callback(std::move(callback)),
clock(Event(base.timeSource.get_event(), sdeventplus::internal::NoOwn())),
interval(interval)
-{
-}
+{}
} // namespace detail
diff --git a/src/sdeventplus/utility/timer.hpp b/src/sdeventplus/utility/timer.hpp
index a378a46..dd2befb 100644
--- a/src/sdeventplus/utility/timer.hpp
+++ b/src/sdeventplus/utility/timer.hpp
@@ -1,13 +1,14 @@
#pragma once
-#include <chrono>
#include <function2/function2.hpp>
-#include <optional>
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/source/time.hpp>
#include <sdeventplus/types.hpp>
+#include <chrono>
+#include <optional>
+
namespace sdeventplus
{
namespace utility
diff --git a/test/clock.cpp b/test/clock.cpp
index e004341..5cba35f 100644
--- a/test/clock.cpp
+++ b/test/clock.cpp
@@ -1,14 +1,17 @@
-#include <cerrno>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <systemd/sd-event.h>
+
+#include <cerrno>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace
diff --git a/test/event.cpp b/test/event.cpp
index ff574be..b6f5699 100644
--- a/test/event.cpp
+++ b/test/event.cpp
@@ -1,12 +1,14 @@
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
-#include <optional>
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/test/sdevent.hpp>
+
+#include <memory>
+#include <optional>
#include <type_traits>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace
@@ -118,8 +120,8 @@
void SetUp()
{
- event =
- std::make_unique<Event>(expected_event, std::false_type(), &mock);
+ event = std::make_unique<Event>(expected_event, std::false_type(),
+ &mock);
}
void TearDown()
diff --git a/test/exception.cpp b/test/exception.cpp
index 2c437e4..7685a88 100644
--- a/test/exception.cpp
+++ b/test/exception.cpp
@@ -1,8 +1,10 @@
-#include <gtest/gtest.h>
#include <sdeventplus/exception.hpp>
+
#include <string>
#include <system_error>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace
diff --git a/test/source/base.cpp b/test/source/base.cpp
index 1b2ed1e..f192546 100644
--- a/test/source/base.cpp
+++ b/test/source/base.cpp
@@ -1,21 +1,24 @@
-#include <cerrno>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
-#include <optional>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/internal/sdevent.hpp>
#include <sdeventplus/source/base.hpp>
#include <sdeventplus/test/sdevent.hpp>
#include <sdeventplus/types.hpp>
+
+#include <cerrno>
+#include <functional>
+#include <memory>
+#include <optional>
#include <string>
-#include <systemd/sd-event.h>
#include <tuple>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
@@ -39,8 +42,7 @@
BaseImpl(const BaseImpl& other, sdeventplus::internal::NoOwn) :
Base(other, sdeventplus::internal::NoOwn())
- {
- }
+ {}
using Base::get_prepare;
};
@@ -50,8 +52,7 @@
public:
BaseImplData(const BaseImpl& base) :
BaseImpl(base, sdeventplus::internal::NoOwn()), BaseData(base)
- {
- }
+ {}
};
BaseImpl::BaseImpl(const Event& event, sd_event_source* source,
@@ -195,8 +196,8 @@
sd_event_source_set_userdata(expected_source, testing::_))
.WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr)));
}
- auto source =
- std::make_unique<BaseImpl>(*event, expected_source, std::false_type());
+ auto source = std::make_unique<BaseImpl>(*event, expected_source,
+ std::false_type());
EXPECT_CALL(mock, sd_event_source_get_userdata(expected_source))
.WillRepeatedly(Return(userdata));
EXPECT_FALSE(source->get_prepare());
diff --git a/test/source/child.cpp b/test/source/child.cpp
index 71a8789..0928433 100644
--- a/test/source/child.cpp
+++ b/test/source/child.cpp
@@ -1,17 +1,20 @@
-#include <cerrno>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
+#include <sys/wait.h>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/child.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <sys/wait.h>
-#include <systemd/sd-event.h>
+
+#include <cerrno>
+#include <functional>
+#include <memory>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
diff --git a/test/source/event.cpp b/test/source/event.cpp
index 0d86617..95a3dc0 100644
--- a/test/source/event.cpp
+++ b/test/source/event.cpp
@@ -1,16 +1,19 @@
-#include <cerrno>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/event.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <systemd/sd-event.h>
+
+#include <cerrno>
+#include <functional>
+#include <memory>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
diff --git a/test/source/io.cpp b/test/source/io.cpp
index e8abb82..2a05d1e 100644
--- a/test/source/io.cpp
+++ b/test/source/io.cpp
@@ -1,16 +1,19 @@
-#include <cerrno>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/io.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <systemd/sd-event.h>
+
+#include <cerrno>
+#include <functional>
+#include <memory>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
@@ -150,8 +153,8 @@
EXPECT_CALL(mock, sd_event_source_get_userdata(expected_source))
.WillRepeatedly(ReturnPointee(&userdata));
}
- io =
- std::make_unique<IO>(*event, fd, events, [](IO&, int, uint32_t) {});
+ io = std::make_unique<IO>(*event, fd, events,
+ [](IO&, int, uint32_t) {});
}
void TearDown()
diff --git a/test/source/signal.cpp b/test/source/signal.cpp
index 9ac0f67..effd7a3 100644
--- a/test/source/signal.cpp
+++ b/test/source/signal.cpp
@@ -1,17 +1,20 @@
-#include <cerrno>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
+#include <signal.h>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/event.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/signal.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <signal.h>
-#include <systemd/sd-event.h>
+
+#include <cerrno>
+#include <functional>
+#include <memory>
#include <type_traits>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
@@ -81,8 +84,8 @@
}
int completions = 0;
const struct signalfd_siginfo* return_si;
- Signal::Callback callback = [&](Signal&,
- const struct signalfd_siginfo* si) {
+ Signal::Callback callback =
+ [&](Signal&, const struct signalfd_siginfo* si) {
return_si = si;
completions++;
};
@@ -113,8 +116,8 @@
testing::_, nullptr))
.WillOnce(Return(-EINVAL));
int completions = 0;
- Signal::Callback callback = [&completions](Signal&,
- const struct signalfd_siginfo*) {
+ Signal::Callback callback =
+ [&completions](Signal&, const struct signalfd_siginfo*) {
completions++;
};
EXPECT_THROW(Signal(*event, sig, std::move(callback)), SdEventError);
diff --git a/test/source/time.cpp b/test/source/time.cpp
index 01d4ae2..5cef5d8 100644
--- a/test/source/time.cpp
+++ b/test/source/time.cpp
@@ -1,17 +1,20 @@
-#include <cerrno>
-#include <chrono>
-#include <functional>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
+#include <systemd/sd-event.h>
+#include <time.h>
+
#include <sdeventplus/clock.hpp>
#include <sdeventplus/exception.hpp>
#include <sdeventplus/source/time.hpp>
#include <sdeventplus/test/sdevent.hpp>
-#include <systemd/sd-event.h>
-#include <time.h>
+
+#include <cerrno>
+#include <chrono>
+#include <functional>
+#include <memory>
#include <utility>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
namespace sdeventplus
{
namespace source
@@ -60,8 +63,8 @@
const Time<id>::TimePoint expected_time(std::chrono::seconds{2});
const Time<id>::Accuracy expected_accuracy(std::chrono::milliseconds{50});
Time<id>::TimePoint saved_time;
- Time<id>::Callback callback = [&saved_time](Time<id>&,
- Time<id>::TimePoint time) {
+ Time<id>::Callback callback =
+ [&saved_time](Time<id>&, Time<id>::TimePoint time) {
saved_time = time;
};
diff --git a/test/utility/sdbus.cpp b/test/utility/sdbus.cpp
index dda33c3..39949c1 100644
--- a/test/utility/sdbus.cpp
+++ b/test/utility/sdbus.cpp
@@ -1,7 +1,8 @@
-#include <gtest/gtest.h>
#include <sdeventplus/source/event.hpp>
#include <sdeventplus/utility/sdbus.hpp>
+#include <gtest/gtest.h>
+
namespace sdeventplus::utility
{
diff --git a/test/utility/timer.cpp b/test/utility/timer.cpp
index 7cf9113..a2472ed 100644
--- a/test/utility/timer.cpp
+++ b/test/utility/timer.cpp
@@ -1,14 +1,17 @@
-#include <chrono>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <memory>
-#include <optional>
+#include <systemd/sd-event.h>
+
#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/test/sdevent.hpp>
#include <sdeventplus/utility/timer.hpp>
+
+#include <chrono>
+#include <memory>
+#include <optional>
#include <stdexcept>
-#include <systemd/sd-event.h>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
namespace sdeventplus
{