diff options
author | Patrick Venture <venture@google.com> | 2018-10-14 13:34:26 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-10-14 13:36:33 -0700 |
commit | a680d1eff9ee796a294761dbdffe62cae4cda161 (patch) | |
tree | 31da3f3f491fe82684428f3c604dda4391357b74 | |
parent | d6819c9fcc44b3691eeb98ef3675d553bb28eeeb (diff) | |
download | phosphor-inventory-manager-a680d1eff9ee796a294761dbdffe62cae4cda161.tar.gz phosphor-inventory-manager-a680d1eff9ee796a294761dbdffe62cae4cda161.zip |
formatter: update clang-format and fix-up file(s)
clang-format-6.0 introduced new changes, also then updates to
.clang-format introduce more new changes.
Change-Id: Iec9f84e3a7a5bf254d66eee46cdc9b3070e06687
Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r-- | .clang-format | 22 | ||||
-rw-r--r-- | app.cpp | 6 | ||||
-rw-r--r-- | errors.cpp | 3 | ||||
-rw-r--r-- | functor.cpp | 1 | ||||
-rw-r--r-- | functor.hpp | 32 | ||||
-rw-r--r-- | manager.cpp | 14 | ||||
-rw-r--r-- | manager.hpp | 23 | ||||
-rw-r--r-- | serialize.hpp | 4 | ||||
-rw-r--r-- | test/test.cpp | 12 | ||||
-rw-r--r-- | types.hpp | 9 | ||||
-rw-r--r-- | utils.hpp | 18 |
11 files changed, 89 insertions, 55 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 @@ -14,11 +14,13 @@ * limitations under the License. */ #include "config.h" + #include "manager.hpp" -#include <sdbusplus/bus.hpp> + #include <cstdlib> -#include <iostream> #include <exception> +#include <iostream> +#include <sdbusplus/bus.hpp> int main(int argc, char* argv[]) { @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <phosphor-logging/log.hpp> #include "errors.hpp" +#include <phosphor-logging/log.hpp> + namespace phosphor { namespace inventory diff --git a/functor.cpp b/functor.cpp index b9e2521..90d713a 100644 --- a/functor.cpp +++ b/functor.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ #include "functor.hpp" + #include <sdbusplus/bus.hpp> namespace phosphor diff --git a/functor.hpp b/functor.hpp index fc763e5..3a3077d 100644 --- a/functor.hpp +++ b/functor.hpp @@ -1,10 +1,11 @@ #pragma once -#include <utility> +#include "types.hpp" +#include "utils.hpp" + #include <memory> #include <sdbusplus/bus.hpp> -#include "utils.hpp" -#include "types.hpp" +#include <utility> namespace phosphor { @@ -24,7 +25,8 @@ class Manager; * * @tparam T - The type of the action being adapted. */ -template <typename T> auto make_action(T&& action) +template <typename T> +auto make_action(T&& action) { return Action(std::forward<T>(action)); } @@ -38,7 +40,8 @@ template <typename T> auto make_action(T&& action) * * @tparam T - The type of the filter being adapted. */ -template <typename T> auto make_filter(T&& filter) +template <typename T> +auto make_filter(T&& filter) { return Filter(std::forward<T>(filter)); } @@ -52,7 +55,8 @@ template <typename T> auto make_filter(T&& filter) * * @tparam T - The type of the functor being adapted. */ -template <typename T> auto make_path_condition(T&& condition) +template <typename T> +auto make_path_condition(T&& condition) { return PathCondition(std::forward<T>(condition)); } @@ -123,11 +127,8 @@ auto setProperty(std::vector<const char*>&& paths, // Bind the path, interface, interface member function pointer, // and value to a lambda. When it is called, forward the // path, interface and value on to the manager member function. - return [ - paths, conditions = conditions, iface, member, - value = std::forward<V>(value) - ](auto& b, auto& m) - { + return [paths, conditions = conditions, iface, member, + value = std::forward<V>(value)](auto& b, auto& m) { for (auto p : paths) { if (callArrayWithStatus(conditions, p, b, m)) @@ -144,7 +145,8 @@ auto setProperty(std::vector<const char*>&& paths, * @tparam T - The type of the property being tested. * @tparam U - The type of the condition checking functor. */ -template <typename T, typename U> struct PropertyChangedCondition +template <typename T, typename U> +struct PropertyChangedCondition { PropertyChangedCondition() = delete; ~PropertyChangedCondition() = default; @@ -309,8 +311,7 @@ struct PropertyCondition final : public PropertyConditionBase template <typename T> auto propertyChangedTo(const char* iface, const char* property, T&& val) { - auto condition = [val = std::forward<T>(val)](T && arg) - { + auto condition = [val = std::forward<T>(val)](T&& arg) { return arg == val; }; using U = decltype(condition); @@ -323,8 +324,7 @@ template <typename T> auto propertyIs(const char* path, const char* iface, const char* property, T&& val, const char* service = nullptr) { - auto condition = [val = std::forward<T>(val)](T && arg) - { + auto condition = [val = std::forward<T>(val)](T&& arg) { return arg == val; }; using U = decltype(condition); diff --git a/manager.cpp b/manager.cpp index 8b35a0a..c138d40 100644 --- a/manager.cpp +++ b/manager.cpp @@ -13,15 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include <iostream> -#include <exception> -#include <chrono> -#include <algorithm> -#include <phosphor-logging/log.hpp> -#include <experimental/filesystem> #include "manager.hpp" + #include "errors.hpp" +#include <algorithm> +#include <chrono> +#include <exception> +#include <experimental/filesystem> +#include <iostream> +#include <phosphor-logging/log.hpp> + using namespace std::literals::chrono_literals; namespace phosphor diff --git a/manager.hpp b/manager.hpp index 9bbd3c7..1213267 100644 --- a/manager.hpp +++ b/manager.hpp @@ -1,15 +1,16 @@ #pragma once +#include "events.hpp" +#include "functor.hpp" +#include "serialize.hpp" +#include "types.hpp" + #include <map> #include <memory> +#include <sdbusplus/server.hpp> #include <string> #include <vector> -#include <sdbusplus/server.hpp> #include <xyz/openbmc_project/Inventory/Manager/server.hpp> -#include "events.hpp" -#include "functor.hpp" -#include "types.hpp" -#include "serialize.hpp" namespace phosphor { @@ -18,7 +19,8 @@ namespace inventory namespace manager { -template <typename T> using ServerObject = T; +template <typename T> +using ServerObject = T; using ManagerIface = sdbusplus::xyz::openbmc_project::Inventory::server::Manager; @@ -32,7 +34,8 @@ using ManagerIface = * * @tparam T - The sdbusplus server binding type. */ -template <typename T, typename Enable = void> struct PropertiesVariant +template <typename T, typename Enable = void> +struct PropertiesVariant { }; @@ -46,7 +49,8 @@ struct PropertiesVariant< template <typename T> using PropertiesVariantType = typename PropertiesVariant<T>::Type; -template <typename T, typename U = int> struct HasProperties : std::false_type +template <typename T, typename U = int> +struct HasProperties : std::false_type { }; @@ -133,7 +137,8 @@ void propDeSerialize(const std::string& path, const std::string& iface, * @tparam T - The type of the interface being adapted. */ -template <typename T> struct MakeInterface +template <typename T> +struct MakeInterface { static any_ns::any make(sdbusplus::bus::bus& bus, const char* path, const Interface& props) diff --git a/serialize.hpp b/serialize.hpp index 132df58..e0fc89a 100644 --- a/serialize.hpp +++ b/serialize.hpp @@ -1,10 +1,10 @@ #pragma once +#include "config.h" + #include <cereal/archives/json.hpp> #include <experimental/filesystem> #include <fstream> -#include "config.h" - #include <phosphor-logging/log.hpp> namespace cereal diff --git a/test/test.cpp b/test/test.cpp index 5cadbe0..2327239 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -13,15 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "manager.hpp" #include "config.h" + +#include "manager.hpp" +#include "xyz/openbmc_project/Example/Iface1/server.hpp" +#include "xyz/openbmc_project/Example/Iface2/server.hpp" + +#include <algorithm> #include <cassert> +#include <chrono> #include <iostream> -#include <algorithm> #include <thread> -#include <chrono> -#include "xyz/openbmc_project/Example/Iface1/server.hpp" -#include "xyz/openbmc_project/Example/Iface2/server.hpp" using namespace std::literals::chrono_literals; using namespace std::literals::string_literals; @@ -1,10 +1,10 @@ #pragma once -#include <map> -#include <string> -#include <sdbusplus/message.hpp> #include <experimental/any> #include <functional> +#include <map> +#include <sdbusplus/message.hpp> +#include <string> namespace phosphor { @@ -20,7 +20,8 @@ namespace any_ns = std::experimental; using InterfaceVariantType = sdbusplus::message::variant<bool, int64_t, std::string>; -template <typename T> using InterfaceType = std::map<std::string, T>; +template <typename T> +using InterfaceType = std::map<std::string, T>; template <typename T> using ObjectType = std::map<std::string, InterfaceType<T>>; @@ -11,7 +11,8 @@ namespace manager * * @tparam V - The desired variant type. */ -template <typename V> struct MakeVariantVisitor +template <typename V> +struct MakeVariantVisitor { /** @struct Make * @brief Return variant visitor. @@ -20,7 +21,8 @@ template <typename V> struct MakeVariantVisitor * @tparam Arg - The type being visited in the source variant. * @tparam Enable - Overload resolution removal. */ - template <typename T, typename Arg, typename Enable = void> struct Make + template <typename T, typename Arg, typename Enable = void> + struct Make { static auto make(Arg&& arg) { @@ -47,7 +49,8 @@ template <typename V> struct MakeVariantVisitor }; /** @brief Make variant visitor. */ - template <typename Arg> auto operator()(Arg&& arg) const + template <typename Arg> + auto operator()(Arg&& arg) const { return Make<V, Arg>::make(arg); } @@ -61,7 +64,8 @@ template <typename V> struct MakeVariantVisitor * @param[in] v - The source variant. * @returns - The converted variant. */ -template <typename V, typename Arg> auto convertVariant(Arg&& v) +template <typename V, typename Arg> +auto convertVariant(Arg&& v) { return sdbusplus::message::variant_ns::apply_visitor( MakeVariantVisitor<V>(), v); @@ -75,7 +79,8 @@ template <typename V, typename Arg> auto convertVariant(Arg&& v) * * @tparam Compare - The function object type being adapted. */ -template <typename Compare> struct CompareFirst +template <typename Compare> +struct CompareFirst { /** @brief Construct a CompareFirst adapter. * @@ -143,7 +148,8 @@ template <typename Compare> struct CompareFirst }; /* @brief Implicit template instantation wrapper for CompareFirst. */ -template <typename Compare> CompareFirst<Compare> compareFirst(Compare&& c) +template <typename Compare> +CompareFirst<Compare> compareFirst(Compare&& c) { return CompareFirst<Compare>(std::forward<Compare>(c)); } |