diff options
37 files changed, 219 insertions, 112 deletions
diff --git a/.clang-format b/.clang-format index bbc1bb1..ea71ad6 100644 --- a/.clang-format +++ b/.clang-format @@ -17,7 +17,7 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false +AlwaysBreakTemplateDeclarations: true BinPackArguments: true BinPackParameters: true BraceWrapping: @@ -42,12 +42,26 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DerivePointerAlignment: true +DerivePointerAlignment: false PointerAlignment: Left DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^[<"](gtest|gmock)' + Priority: 5 + - Regex: '^"config.h"' + Priority: -1 + - Regex: '^".*\.hpp"' + Priority: 1 + - Regex: '^<.*\.h>' + Priority: 2 + - Regex: '^<.*' + Priority: 3 + - Regex: '.*' + Priority: 4 IndentCaseLabels: true IndentWidth: 4 IndentWrappedFunctionNames: true @@ -65,9 +79,9 @@ PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right ReflowComments: true -SortIncludes: false +SortIncludes: true +SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements diff --git a/mslverify/util.hpp b/mslverify/util.hpp index f487cee..e0d07ca 100644 --- a/mslverify/util.hpp +++ b/mslverify/util.hpp @@ -1,10 +1,10 @@ #pragma once +#include <phosphor-logging/elog-errors.hpp> +#include <phosphor-logging/elog.hpp> +#include <phosphor-logging/log.hpp> #include <sdbusplus/bus.hpp> #include <sdbusplus/message.hpp> -#include <phosphor-logging/log.hpp> -#include <phosphor-logging/elog.hpp> -#include <phosphor-logging/elog-errors.hpp> #include <xyz/openbmc_project/Common/error.hpp> namespace util diff --git a/mslverify/verify.cpp b/mslverify/verify.cpp index c9c06aa..a4b3ece 100644 --- a/mslverify/verify.cpp +++ b/mslverify/verify.cpp @@ -14,14 +14,16 @@ * limitations under the License. */ +#include "util.hpp" + #include <algorithm> #include <map> #include <string> -#include "util.hpp" using namespace std::literals::string_literals; -template <typename T> struct BusMeetsMSL +template <typename T> +struct BusMeetsMSL { std::string path; @@ -43,7 +45,8 @@ template <typename T> struct BusMeetsMSL } }; -template <typename T> struct PathMeetsMSL +template <typename T> +struct PathMeetsMSL { auto operator()(const T& arg) { diff --git a/src/callback.hpp b/src/callback.hpp index e1e2325..c79dcd0 100644 --- a/src/callback.hpp +++ b/src/callback.hpp @@ -1,8 +1,9 @@ #pragma once -#include <chrono> #include "data_types.hpp" +#include <chrono> + namespace phosphor { namespace dbus @@ -124,7 +125,8 @@ class IndexedCallback : public Callback * * @tparam CallbackAccess - Access to the array of callbacks. */ -template <typename CallbackAccess> class GroupOfCallbacks : public Callback +template <typename CallbackAccess> +class GroupOfCallbacks : public Callback { public: GroupOfCallbacks() = delete; @@ -155,7 +157,8 @@ template <typename CallbackAccess> class GroupOfCallbacks : public Callback /** @class ConditionalCallback * @brief Callback adaptor that asssociates a condition with a callback. */ -template <typename CallbackAccess> class ConditionalCallback : public Callback +template <typename CallbackAccess> +class ConditionalCallback : public Callback { public: ConditionalCallback() = delete; diff --git a/src/count.hpp b/src/count.hpp index af3998a..3e18e20 100644 --- a/src/count.hpp +++ b/src/count.hpp @@ -31,7 +31,8 @@ namespace monitoring * If the oneshot parameter is true, then this condition won't pass * again until it fails at least once. */ -template <typename T> class CountCondition : public IndexedConditional +template <typename T> +class CountCondition : public IndexedConditional { public: CountCondition() = delete; diff --git a/src/data_types.hpp b/src/data_types.hpp index cf0d69e..c96f1a0 100644 --- a/src/data_types.hpp +++ b/src/data_types.hpp @@ -1,8 +1,9 @@ #pragma once +#include "tupleref.hpp" + #include <experimental/any> #include <sdbusplus/message.hpp> -#include "tupleref.hpp" namespace any_ns = std::experimental; @@ -46,7 +47,8 @@ template <typename Value, typename... Keys> using TupleRefMap = std::map<TupleOfRefs<Keys...>, Value, TupleOfRefsLess>; /** @brief A vector of references. */ -template <typename T> using RefVector = std::vector<std::reference_wrapper<T>>; +template <typename T> +using RefVector = std::vector<std::reference_wrapper<T>>; /** @brief * @@ -92,11 +94,13 @@ using PropertyIndex = * 1. Remove references. * 2. Remove 'const' and 'volatile'. */ -template <typename T> struct Downcast +template <typename T> +struct Downcast { using Type = std::remove_cv_t<std::remove_reference_t<T>>; }; -template <typename T> using DowncastType = typename Downcast<T>::Type; +template <typename T> +using DowncastType = typename Downcast<T>::Type; } // namespace monitoring } // namespace dbus diff --git a/src/elog.hpp b/src/elog.hpp index 24e2009..d98984c 100644 --- a/src/elog.hpp +++ b/src/elog.hpp @@ -1,9 +1,10 @@ #pragma once +#include "callback.hpp" + +#include <experimental/tuple> #include <phosphor-logging/elog-errors.hpp> #include <phosphor-logging/elog.hpp> -#include "callback.hpp" #include <sdbusplus/exception.hpp> -#include <experimental/tuple> namespace phosphor { @@ -15,7 +16,8 @@ namespace monitoring /** @struct ToString * @brief Convert numbers to strings */ -template <typename T> struct ToString +template <typename T> +struct ToString { static auto op(T&& value) { @@ -23,7 +25,8 @@ template <typename T> struct ToString } }; -template <> struct ToString<std::string> +template <> +struct ToString<std::string> { static auto op(const std::string& value) { @@ -66,7 +69,8 @@ namespace detail * @tparam T - Error log type * @tparam Args - Metadata fields types. */ -template <typename T, typename... Args> struct CallElog +template <typename T, typename... Args> +struct CallElog { static void op(Args&&... args) { @@ -84,7 +88,8 @@ template <typename T, typename... Args> struct CallElog * @tparam Args - Metadata fields types. * @param[in] arguments - Metadata fields to be added to the error log */ -template <typename T, typename... Args> class Elog : public ElogBase +template <typename T, typename... Args> +class Elog : public ElogBase { public: Elog(const Elog&) = delete; @@ -210,7 +215,8 @@ class ElogWithMetadataCapture : public IndexedCallback * @tparam Args - Metadata fields types. * @param[in] arguments - Metadata fields to be added to the error log */ -template <typename T, typename... Args> auto makeElog(Args&&... arguments) +template <typename T, typename... Args> +auto makeElog(Args&&... arguments) { return std::make_unique<Elog<T, Args...>>(std::forward<Args>(arguments)...); } diff --git a/src/event.hpp b/src/event.hpp index a2a2236..f9104f8 100644 --- a/src/event.hpp +++ b/src/event.hpp @@ -1,9 +1,9 @@ #pragma once -#include <phosphor-logging/log.hpp> #include "callback.hpp" #include "event_manager.hpp" +#include <phosphor-logging/log.hpp> #include <sstream> namespace phosphor @@ -76,7 +76,8 @@ class EventBase : public IndexedCallback * * @tparam T - The C++ type of the property values being traced. */ -template <typename T> class Event : public EventBase +template <typename T> +class Event : public EventBase { public: Event() = delete; diff --git a/src/event_manager.cpp b/src/event_manager.cpp index 57a8478..874c5a8 100644 --- a/src/event_manager.cpp +++ b/src/event_manager.cpp @@ -15,8 +15,10 @@ */ #include "config.h" -#include "event.hpp" + #include "event_manager.hpp" + +#include "event.hpp" #include "event_serialize.hpp" #include <experimental/filesystem> diff --git a/src/event_serialize.cpp b/src/event_serialize.cpp index ddfc4b6..ca43c41 100644 --- a/src/event_serialize.cpp +++ b/src/event_serialize.cpp @@ -1,11 +1,12 @@ +#include "config.h" + +#include "event_serialize.hpp" + +#include <cereal/archives/binary.hpp> #include <cereal/types/string.hpp> #include <cereal/types/vector.hpp> -#include <cereal/archives/binary.hpp> #include <fstream> - -#include "event_serialize.hpp" #include <phosphor-logging/log.hpp> -#include "config.h" // Register class version // From cereal documentation; diff --git a/src/event_serialize.hpp b/src/event_serialize.hpp index f052845..d331950 100644 --- a/src/event_serialize.hpp +++ b/src/event_serialize.hpp @@ -1,9 +1,11 @@ #pragma once -#include <experimental/filesystem> -#include "event_entry.hpp" #include "config.h" +#include "event_entry.hpp" + +#include <experimental/filesystem> + namespace phosphor { namespace events diff --git a/src/format.hpp b/src/format.hpp index f622f2e..32a85f8 100644 --- a/src/format.hpp +++ b/src/format.hpp @@ -12,62 +12,77 @@ namespace detail { /** @brief Map format strings to undecorated C++ types. */ -template <typename T> struct GetFormatType +template <typename T> +struct GetFormatType { }; -template <> struct GetFormatType<bool> +template <> +struct GetFormatType<bool> { static constexpr auto format = "%d"; }; -template <> struct GetFormatType<char> +template <> +struct GetFormatType<char> { static constexpr auto format = "=%hhd"; }; -template <> struct GetFormatType<short int> +template <> +struct GetFormatType<short int> { static constexpr auto format = "=%hd"; }; -template <> struct GetFormatType<int> +template <> +struct GetFormatType<int> { static constexpr auto format = "=%d"; }; -template <> struct GetFormatType<long int> +template <> +struct GetFormatType<long int> { static constexpr auto format = "=%ld"; }; -template <> struct GetFormatType<long long int> +template <> +struct GetFormatType<long long int> { static constexpr auto format = "=%lld"; }; -template <> struct GetFormatType<unsigned char> +template <> +struct GetFormatType<unsigned char> { static constexpr auto format = "=%hhd"; }; -template <> struct GetFormatType<unsigned short int> +template <> +struct GetFormatType<unsigned short int> { static constexpr auto format = "=%hd"; }; -template <> struct GetFormatType<unsigned int> +template <> +struct GetFormatType<unsigned int> { static constexpr auto format = "=%d"; }; -template <> struct GetFormatType<unsigned long int> +template <> +struct GetFormatType<unsigned long int> { static constexpr auto format = "=%ld"; }; -template <> struct GetFormatType<unsigned long long int> +template <> +struct GetFormatType<unsigned long long int> { static constexpr auto format = "=%lld"; }; -template <> struct GetFormatType<std::string> +template <> +struct GetFormatType<std::string> { static constexpr auto format = "=%s"; }; -template <> struct GetFormatType<char*> +template <> +struct GetFormatType<char*> { static constexpr auto format = "=%s"; }; -template <> struct GetFormatType<const char*> +template <> +struct GetFormatType<const char*> { static constexpr auto format = "=%s"; }; @@ -75,7 +90,8 @@ template <> struct GetFormatType<const char*> } // namespace detail /** @brief Get the format string for a C++ type. */ -template <typename T> struct GetFormat +template <typename T> +struct GetFormat { static constexpr auto format = detail::GetFormatType<DowncastType<T>>::format; diff --git a/src/journal.hpp b/src/journal.hpp index 249a7a2..e69a709 100644 --- a/src/journal.hpp +++ b/src/journal.hpp @@ -1,9 +1,10 @@ #pragma once -#include <phosphor-logging/log.hpp> #include "callback.hpp" #include "format.hpp" +#include <phosphor-logging/log.hpp> + namespace phosphor { namespace dbus @@ -50,7 +51,8 @@ class JournalBase : public IndexedCallback */ namespace detail { -template <typename T> struct Display +template <typename T> +struct Display { static auto op(T&& value) { @@ -58,7 +60,8 @@ template <typename T> struct Display } }; -template <> struct Display<std::string> +template <> +struct Display<std::string> { static auto op(const std::string& value) { diff --git a/src/main.cpp b/src/main.cpp index 3b75e3b..0626081 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ */ #include "config.h" + #include "generated.hpp" #include "sdbusplus.hpp" diff --git a/src/method.hpp b/src/method.hpp index 7c29205..86326b6 100644 --- a/src/method.hpp +++ b/src/method.hpp @@ -1,8 +1,9 @@ #pragma once -#include <experimental/tuple> #include "callback.hpp" +#include <experimental/tuple> + namespace phosphor { namespace dbus @@ -19,7 +20,8 @@ namespace detail * @tparam DBusInterface - The DBus interface to use. * @tparam MethodArgs - DBus method argument types. */ -template <typename DBusInterface, typename... MethodArgs> struct CallDBusMethod +template <typename DBusInterface, typename... MethodArgs> +struct CallDBusMethod { static void op(const std::string& bus, const std::string& path, const std::string& iface, const std::string& method, diff --git a/src/pathwatch.hpp b/src/pathwatch.hpp index db81bec..b0b8b42 100644 --- a/src/pathwatch.hpp +++ b/src/pathwatch.hpp @@ -22,7 +22,8 @@ class Callback; /** @class PathWatch * @brief Watch on object path for interfaceadded/interfaceremoved signals */ -template <typename DBusInterfaceType> class PathWatch : public Watch +template <typename DBusInterfaceType> +class PathWatch : public Watch { public: PathWatch() = delete; diff --git a/src/pathwatchimpl.hpp b/src/pathwatchimpl.hpp index 6be0f50..8b7e8ee 100644 --- a/src/pathwatchimpl.hpp +++ b/src/pathwatchimpl.hpp @@ -5,13 +5,14 @@ */ #pragma once -#include <sdbusplus/message.hpp> -#include <sdbusplus/bus/match.hpp> -#include <vector> #include "callback.hpp" #include "data_types.hpp" #include "pathwatch.hpp" +#include <sdbusplus/bus/match.hpp> +#include <sdbusplus/message.hpp> +#include <vector> + namespace phosphor { namespace dbus @@ -19,7 +20,8 @@ namespace dbus namespace monitoring { -template <typename DBusInterfaceType> void PathWatch<DBusInterfaceType>::start() +template <typename DBusInterfaceType> +void PathWatch<DBusInterfaceType>::start() { if (alreadyRan) { diff --git a/src/propertywatch.hpp b/src/propertywatch.hpp index 2cbf6f5..a94b99e 100644 --- a/src/propertywatch.hpp +++ b/src/propertywatch.hpp @@ -25,7 +25,8 @@ class Callback; * A property watch maintains the state of one or more DBus properties * as specified by the supplied index. */ -template <typename DBusInterfaceType> class PropertyWatch : public Watch +template <typename DBusInterfaceType> +class PropertyWatch : public Watch { public: PropertyWatch() = delete; diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp index 6500a15..2a44abc 100644 --- a/src/propertywatchimpl.hpp +++ b/src/propertywatchimpl.hpp @@ -1,12 +1,13 @@ #pragma once -#include <sdbusplus/message.hpp> -#include <sdbusplus/bus/match.hpp> -#include <vector> #include "callback.hpp" #include "data_types.hpp" #include "propertywatch.hpp" +#include <sdbusplus/bus/match.hpp> +#include <sdbusplus/message.hpp> +#include <vector> + namespace phosphor { namespace dbus diff --git a/src/resolve_errors.cpp b/src/resolve_errors.cpp index 47277eb..e932aff 100644 --- a/src/resolve_errors.cpp +++ b/src/resolve_errors.cpp @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <phosphor-logging/log.hpp> #include "resolve_errors.hpp" + #include "sdbusplus.hpp" +#include <phosphor-logging/log.hpp> + namespace phosphor { namespace dbus diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp index 0a8e715..96a8903 100644 --- a/src/sdbusplus.hpp +++ b/src/sdbusplus.hpp @@ -1,11 +1,12 @@ #pragma once +#include "data_types.hpp" + #include <phosphor-logging/log.hpp> #include <sdbusplus/bus.hpp> +#include <sdbusplus/bus/match.hpp> #include <sdbusplus/exception.hpp> #include <sdbusplus/message.hpp> -#include <sdbusplus/bus/match.hpp> -#include "data_types.hpp" struct Loop; diff --git a/src/sdevent/event.hpp b/src/sdevent/event.hpp index e3d1b22..9ef5791 100644 --- a/src/sdevent/event.hpp +++ b/src/sdevent/event.hpp @@ -1,9 +1,10 @@ #pragma once +#include <systemd/sd-event.h> + #include <chrono> #include <memory> #include <sdbusplus/bus.hpp> -#include <systemd/sd-event.h> // TODO: openbmc/openbmc#1720 - add error handling for sd_event API failures diff --git a/src/sdevent/source.hpp b/src/sdevent/source.hpp index 4f837be..6b20c29 100644 --- a/src/sdevent/source.hpp +++ b/src/sdevent/source.hpp @@ -1,8 +1,9 @@ #pragma once +#include <systemd/sd-event.h> + #include <chrono> #include <memory> -#include <systemd/sd-event.h> // TODO: openbmc/openbmc#1720 - add error handling for sd_event API failures diff --git a/src/sdevent/timer.hpp b/src/sdevent/timer.hpp index 5e45b94..405da4e 100644 --- a/src/sdevent/timer.hpp +++ b/src/sdevent/timer.hpp @@ -1,12 +1,13 @@ #pragma once +#include "sdevent/event.hpp" +#include "sdevent/source.hpp" + +#include <systemd/sd-event.h> + #include <chrono> #include <functional> #include <memory> -#include <systemd/sd-event.h> - -#include "sdevent/source.hpp" -#include "sdevent/event.hpp" // TODO: openbmc/openbmc#1720 - add error handling for sd_event API failures diff --git a/src/snmp_trap.cpp b/src/snmp_trap.cpp index 27b8133..cc730b7 100644 --- a/src/snmp_trap.cpp +++ b/src/snmp_trap.cpp @@ -1,11 +1,12 @@ #include "snmp_trap.hpp" + +#include <phosphor-logging/elog-errors.hpp> +#include <phosphor-logging/elog.hpp> +#include <phosphor-logging/log.hpp> #include <snmp.hpp> #include <snmp_notification.hpp> -#include <phosphor-logging/log.hpp> -#include <phosphor-logging/elog.hpp> -#include <phosphor-logging/elog-errors.hpp> -#include <xyz/openbmc_project/Logging/Entry/server.hpp> #include <xyz/openbmc_project/Common/error.hpp> +#include <xyz/openbmc_project/Logging/Entry/server.hpp> namespace phosphor { namespace dbus diff --git a/src/snmp_trap.hpp b/src/snmp_trap.hpp index 2f93189..4555e65 100644 --- a/src/snmp_trap.hpp +++ b/src/snmp_trap.hpp @@ -47,7 +47,8 @@ class ErrorTrap : public Trap /** @class SNMPTrap * @brief SNMP trap callback implementation. */ -template <typename T> class SNMPTrap : public Callback +template <typename T> +class SNMPTrap : public Callback { public: SNMPTrap(const SNMPTrap&) = delete; diff --git a/src/test/callbackgentest.cpp b/src/test/callbackgentest.cpp index cda665d..87bf160 100644 --- a/src/test/callbackgentest.cpp +++ b/src/test/callbackgentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace phosphor::dbus::monitoring; diff --git a/src/test/callbackgroupgentest.cpp b/src/test/callbackgroupgentest.cpp index fe760ec..64811d7 100644 --- a/src/test/callbackgroupgentest.cpp +++ b/src/test/callbackgroupgentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace phosphor::dbus::monitoring; diff --git a/src/test/callbacktest.cpp b/src/test/callbacktest.cpp index 78736f8..f0c96e0 100644 --- a/src/test/callbacktest.cpp +++ b/src/test/callbacktest.cpp @@ -1,7 +1,7 @@ -#include <gtest/gtest.h> - #include "generated.hpp" +#include <gtest/gtest.h> + using namespace phosphor::dbus::monitoring; TEST(JournalTest, Test) diff --git a/src/test/conditiongentest.cpp b/src/test/conditiongentest.cpp index d0df215..95d9907 100644 --- a/src/test/conditiongentest.cpp +++ b/src/test/conditiongentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace phosphor::dbus::monitoring; diff --git a/src/test/interfaceaddtest.cpp b/src/test/interfaceaddtest.cpp index d80f437..aabacf0 100644 --- a/src/test/interfaceaddtest.cpp +++ b/src/test/interfaceaddtest.cpp @@ -1,8 +1,10 @@ +#include "event.hpp" +#include "pathwatchimpl.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "pathwatchimpl.hpp" -#include "event.hpp" using namespace std::string_literals; using namespace phosphor::dbus::monitoring; diff --git a/src/test/pathgentest.cpp b/src/test/pathgentest.cpp index 1f75153..9e0e073 100644 --- a/src/test/pathgentest.cpp +++ b/src/test/pathgentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace std::string_literals; using namespace phosphor::dbus::monitoring; diff --git a/src/test/propertygentest.cpp b/src/test/propertygentest.cpp index e9da733..4124246 100644 --- a/src/test/propertygentest.cpp +++ b/src/test/propertygentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace std::string_literals; using namespace phosphor::dbus::monitoring; diff --git a/src/test/propertywatchgentest.cpp b/src/test/propertywatchgentest.cpp index 2e446a4..b1fe6c4 100644 --- a/src/test/propertywatchgentest.cpp +++ b/src/test/propertywatchgentest.cpp @@ -1,7 +1,9 @@ +#include "data_types.hpp" + #include <array> #include <string> + #include <gtest/gtest.h> -#include "data_types.hpp" using namespace std::string_literals; using namespace phosphor::dbus::monitoring; diff --git a/src/test/propertywatchtest.cpp b/src/test/propertywatchtest.cpp index bb021a2..1cf7729 100644 --- a/src/test/propertywatchtest.cpp +++ b/src/test/propertywatchtest.cpp @@ -1,7 +1,9 @@ -#include <array> -#include "propertywatchimpl.hpp" #include "propertywatchtest.hpp" +#include "propertywatchimpl.hpp" + +#include <array> + using namespace std::string_literals; using namespace phosphor::dbus::monitoring; @@ -47,10 +49,12 @@ const PropertyIndex watchIndex = { }, }; -template <typename T> struct ExpectedValues +template <typename T> +struct ExpectedValues { }; -template <> struct ExpectedValues<uint8_t> +template <> +struct ExpectedValues<uint8_t> { static auto& get(size_t i) { @@ -61,7 +65,8 @@ template <> struct ExpectedValues<uint8_t> } }; -template <> struct ExpectedValues<uint16_t> +template <> +struct ExpectedValues<uint16_t> { static auto& get(size_t i) { @@ -72,7 +77,8 @@ template <> struct ExpectedValues<uint16_t> } }; -template <> struct ExpectedValues<uint32_t> +template <> +struct ExpectedValues<uint32_t> { static auto& get(size_t i) { @@ -83,7 +89,8 @@ template <> struct ExpectedValues<uint32_t> } }; -template <> struct ExpectedValues<uint64_t> +template <> +struct ExpectedValues<uint64_t> { static auto& get(size_t i) { @@ -94,7 +101,8 @@ template <> struct ExpectedValues<uint64_t> } }; -template <> struct ExpectedValues<std::string> +template <> +struct ExpectedValues<std::string> { static auto& get(size_t i) { @@ -105,7 +113,8 @@ template <> struct ExpectedValues<std::string> } }; -template <typename T> void testStart() +template <typename T> +void testStart() { using ::testing::_; using ::testing::Return; diff --git a/src/test/propertywatchtest.hpp b/src/test/propertywatchtest.hpp index d226f93..e27ba18 100644 --- a/src/test/propertywatchtest.hpp +++ b/src/test/propertywatchtest.hpp @@ -1,11 +1,12 @@ #pragma once -#include <gmock/gmock.h> -#include <gtest/gtest.h> -#include <string> - #include "data_types.hpp" #include "sdbusplus/bus/match.hpp" +#include <string> + +#include <gmock/gmock.h> +#include <gtest/gtest.h> + namespace phosphor { namespace dbus @@ -292,11 +293,13 @@ struct MockDBusInterface /** @class Expect * @brief Enable use of EXPECT_CALL from a C++ template. */ -template <typename T> struct Expect +template <typename T> +struct Expect { }; -template <> struct Expect<uint64_t> +template <> +struct Expect<uint64_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -309,7 +312,8 @@ template <> struct Expect<uint64_t> } }; -template <> struct Expect<uint32_t> +template <> +struct Expect<uint32_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -322,7 +326,8 @@ template <> struct Expect<uint32_t> } }; -template <> struct Expect<uint16_t> +template <> +struct Expect<uint16_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -335,7 +340,8 @@ template <> struct Expect<uint16_t> } }; -template <> struct Expect<uint8_t> +template <> +struct Expect<uint8_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -348,7 +354,8 @@ template <> struct Expect<uint8_t> } }; -template <> struct Expect<int64_t> +template <> +struct Expect<int64_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -361,7 +368,8 @@ template <> struct Expect<int64_t> } }; -template <> struct Expect<int32_t> +template <> +struct Expect<int32_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -374,7 +382,8 @@ template <> struct Expect<int32_t> } }; -template <> struct Expect<int16_t> +template <> +struct Expect<int16_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -387,7 +396,8 @@ template <> struct Expect<int16_t> } }; -template <> struct Expect<int8_t> +template <> +struct Expect<int8_t> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, @@ -400,7 +410,8 @@ template <> struct Expect<int8_t> } }; -template <> struct Expect<std::string> +template <> +struct Expect<std::string> { template <typename MockObjType> static auto& getProperties(MockObjType&& mockObj, const std::string& path, diff --git a/src/tupleref.hpp b/src/tupleref.hpp index 3e896be..18bd7f4 100644 --- a/src/tupleref.hpp +++ b/src/tupleref.hpp @@ -17,7 +17,8 @@ using TupleOfRefs = std::tuple<std::reference_wrapper<T>...>; namespace detail { /** @brief Less than implementation for tuples of references. */ -template <size_t size, size_t i, typename T, typename U> struct TupleOfRefsLess +template <size_t size, size_t i, typename T, typename U> +struct TupleOfRefsLess { static constexpr bool compare(const T& l, const U& r) { |