clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: If152304b21dd2daaa2f79255a4f98218615efb05
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index a75a2c2..e5530e6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -104,7 +104,7 @@
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyReturnTypeOnItsOwnLine: 150
PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
diff --git a/control/actions.hpp b/control/actions.hpp
index fd9ad62..39f407a 100644
--- a/control/actions.hpp
+++ b/control/actions.hpp
@@ -184,8 +184,8 @@
* below(decreasing) the key transition point
*/
template <typename T>
-Action
- set_ceiling_from_average_sensor_value(std::map<T, uint64_t>&& val_to_speed)
+Action set_ceiling_from_average_sensor_value(
+ std::map<T, uint64_t>&& val_to_speed)
{
return [val_to_speed =
std::move(val_to_speed)](Zone& zone, const Group& group) {
diff --git a/control/json/actions/action.hpp b/control/json/actions/action.hpp
index 93cd9e2..6cc5bac 100644
--- a/control/json/actions/action.hpp
+++ b/control/json/actions/action.hpp
@@ -82,9 +82,9 @@
* sets the zones the action should run against.
*/
template <typename T>
-std::unique_ptr<T>
- createAction(const json& jsonObj, const std::vector<Group>& groups,
- std::vector<std::reference_wrapper<Zone>>& zones)
+std::unique_ptr<T> createAction(
+ const json& jsonObj, const std::vector<Group>& groups,
+ std::vector<std::reference_wrapper<Zone>>& zones)
{
// Create the action and set its list of zones
auto action = std::make_unique<T>(jsonObj, groups);
@@ -319,10 +319,10 @@
*
* @return Pointer to the action object.
*/
- static std::unique_ptr<ActionBase>
- getAction(const std::string& name, const json& jsonObj,
- const std::vector<Group>& groups,
- std::vector<std::reference_wrapper<Zone>>&& zones)
+ static std::unique_ptr<ActionBase> getAction(
+ const std::string& name, const json& jsonObj,
+ const std::vector<Group>& groups,
+ std::vector<std::reference_wrapper<Zone>>&& zones)
{
auto it = actions.find(name);
if (it != actions.end())
diff --git a/control/json/actions/mapped_floor.cpp b/control/json/actions/mapped_floor.cpp
index ab50075..7cad6a4 100644
--- a/control/json/actions/mapped_floor.cpp
+++ b/control/json/actions/mapped_floor.cpp
@@ -242,8 +242,8 @@
value);
}
-std::optional<PropertyVariantType>
- MappedFloor::getMaxGroupValue(const Group& group)
+std::optional<PropertyVariantType> MappedFloor::getMaxGroupValue(
+ const Group& group)
{
std::optional<PropertyVariantType> max;
bool checked = false;
diff --git a/control/json/actions/pcie_card_floors.hpp b/control/json/actions/pcie_card_floors.hpp
index 081f409..e7c21a3 100644
--- a/control/json/actions/pcie_card_floors.hpp
+++ b/control/json/actions/pcie_card_floors.hpp
@@ -142,8 +142,8 @@
* - The floor index or true for has temp sensor if found,
* std::nullopt else.
*/
- std::optional<std::variant<int32_t, bool>>
- getFloorIndexFromSlot(const std::string& slotPath);
+ std::optional<std::variant<int32_t, bool>> getFloorIndexFromSlot(
+ const std::string& slotPath);
/**
* @brief Gets the hex PCIeDevice property value from the
diff --git a/control/json/actions/set_parameter_from_group_max.hpp b/control/json/actions/set_parameter_from_group_max.hpp
index ad0114c..61a9836 100644
--- a/control/json/actions/set_parameter_from_group_max.hpp
+++ b/control/json/actions/set_parameter_from_group_max.hpp
@@ -63,8 +63,8 @@
SetParameterFromGroupMax() = delete;
SetParameterFromGroupMax(const SetParameterFromGroupMax&) = delete;
SetParameterFromGroupMax(SetParameterFromGroupMax&&) = delete;
- SetParameterFromGroupMax&
- operator=(const SetParameterFromGroupMax&) = delete;
+ SetParameterFromGroupMax& operator=(const SetParameterFromGroupMax&) =
+ delete;
SetParameterFromGroupMax& operator=(SetParameterFromGroupMax&&) = delete;
virtual ~SetParameterFromGroupMax() = default;
diff --git a/control/json/actions/timer_based_actions.hpp b/control/json/actions/timer_based_actions.hpp
index c36ecf6..12e6198 100644
--- a/control/json/actions/timer_based_actions.hpp
+++ b/control/json/actions/timer_based_actions.hpp
@@ -111,8 +111,8 @@
*
* Sets the zones on this action and the timer's actions to run against
*/
- virtual void
- setZones(std::vector<std::reference_wrapper<Zone>>& zones) override;
+ virtual void setZones(
+ std::vector<std::reference_wrapper<Zone>>& zones) override;
private:
/* The timer for this action */
diff --git a/control/json/event.cpp b/control/json/event.cpp
index 0e7f1e5..fa3502d 100644
--- a/control/json/event.cpp
+++ b/control/json/event.cpp
@@ -90,8 +90,8 @@
}
}
-std::map<configKey, std::unique_ptr<Group>>&
- Event::getAllGroups(bool loadGroups)
+std::map<configKey, std::unique_ptr<Group>>& Event::getAllGroups(
+ bool loadGroups)
{
if (allGroups.empty() && loadGroups)
{
diff --git a/control/json/event.hpp b/control/json/event.hpp
index e0bdd06..9d3443a 100644
--- a/control/json/event.hpp
+++ b/control/json/event.hpp
@@ -101,8 +101,8 @@
*
* @param[in] groups - All groups available for events
*/
- static void
- setAllGroups(std::map<configKey, std::unique_ptr<Group>>&& groups)
+ static void setAllGroups(
+ std::map<configKey, std::unique_ptr<Group>>&& groups)
{
allGroups = std::move(groups);
}
@@ -115,8 +115,8 @@
*
* @return Groups available to be configured on events from `groups.json`
*/
- static std::map<configKey, std::unique_ptr<Group>>&
- getAllGroups(bool loadGroups = true);
+ static std::map<configKey, std::unique_ptr<Group>>& getAllGroups(
+ bool loadGroups = true);
/**
* @brief Parse group parameters and configure a group object
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 6ae51c9..a74b1b8 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -460,8 +460,8 @@
return serviceName;
}
-std::vector<std::string>
- Manager::findPaths(const std::string& serv, const std::string& intf)
+std::vector<std::string> Manager::findPaths(const std::string& serv,
+ const std::string& intf)
{
std::vector<std::string> paths;
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 2f66181..5d94623 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -198,8 +198,8 @@
* Map of configuration keys to their corresponding configuration object
*/
template <typename T, typename... Args>
- static std::map<configKey, std::unique_ptr<T>>
- getConfig(bool isOptional, Args&&... args)
+ static std::map<configKey, std::unique_ptr<T>> getConfig(bool isOptional,
+ Args&&... args)
{
std::map<configKey, std::unique_ptr<T>> config;
@@ -381,9 +381,9 @@
* @param[in] intf - Dbus object's interface
* @param[in] prop - Dbus object's property
*/
- const std::optional<PropertyVariantType>
- getProperty(const std::string& path, const std::string& intf,
- const std::string& prop);
+ const std::optional<PropertyVariantType> getProperty(
+ const std::string& path, const std::string& intf,
+ const std::string& prop);
/**
* @brief Set/update an object's property value
@@ -536,8 +536,8 @@
*
* @return The parameter value, or std::nullopt if not found
*/
- static std::optional<PropertyVariantType>
- getParameter(const std::string& name)
+ static std::optional<PropertyVariantType> getParameter(
+ const std::string& name)
{
auto it = _parameters.find(name);
if (it != _parameters.end())
@@ -562,9 +562,9 @@
* @param[in] name - The parameter name
* @param[in] actions - The actions to run on the trigger
*/
- static void
- addParameterTrigger(const std::string& name,
- std::vector<std::unique_ptr<ActionBase>>& actions);
+ static void addParameterTrigger(
+ const std::string& name,
+ std::vector<std::unique_ptr<ActionBase>>& actions);
/* The name of the dump file */
static const std::string dumpFile;
diff --git a/control/json/triggers/parameter.cpp b/control/json/triggers/parameter.cpp
index 6986608..1bec051 100644
--- a/control/json/triggers/parameter.cpp
+++ b/control/json/triggers/parameter.cpp
@@ -24,9 +24,9 @@
using json = nlohmann::json;
-enableTrigger
- triggerParameter(const json& jsonObj, const std::string& eventName,
- std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
+enableTrigger triggerParameter(
+ const json& jsonObj, const std::string& eventName,
+ std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
{
if (!jsonObj.contains("parameter"))
{
diff --git a/control/json/triggers/parameter.hpp b/control/json/triggers/parameter.hpp
index ed7d4fa..8554b4d 100644
--- a/control/json/triggers/parameter.hpp
+++ b/control/json/triggers/parameter.hpp
@@ -34,8 +34,8 @@
* @param[in] eventName - Name of event associated to the signal
* @param[in] actions - Actions associated with the trigger
*/
-enableTrigger
- triggerParameter(const json& jsonObj, const std::string& eventName,
- std::vector<std::unique_ptr<ActionBase>>& actions);
+enableTrigger triggerParameter(
+ const json& jsonObj, const std::string& eventName,
+ std::vector<std::unique_ptr<ActionBase>>& actions);
} // namespace phosphor::fan::control::json::trigger::parameter
diff --git a/control/json/triggers/signal.cpp b/control/json/triggers/signal.cpp
index c0641d9..39c20b1 100644
--- a/control/json/triggers/signal.cpp
+++ b/control/json/triggers/signal.cpp
@@ -235,9 +235,9 @@
}
}
-enableTrigger
- triggerSignal(const json& jsonObj, const std::string& eventName,
- std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
+enableTrigger triggerSignal(
+ const json& jsonObj, const std::string& eventName,
+ std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
{
auto subscriber = signals.end();
if (jsonObj.contains("signal"))
diff --git a/control/json/triggers/timer.cpp b/control/json/triggers/timer.cpp
index 2036042..8acbc41 100644
--- a/control/json/triggers/timer.cpp
+++ b/control/json/triggers/timer.cpp
@@ -80,9 +80,9 @@
return false;
}
-enableTrigger
- triggerTimer(const json& jsonObj, const std::string& /*eventName*/,
- std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
+enableTrigger triggerTimer(
+ const json& jsonObj, const std::string& /*eventName*/,
+ std::vector<std::unique_ptr<ActionBase>>& /*actions*/)
{
// Get the type and interval of this timer from the JSON
auto type = getType(jsonObj);
diff --git a/control/json/utils/modifier.cpp b/control/json/utils/modifier.cpp
index c8fb536..0b4adfd 100644
--- a/control/json/utils/modifier.cpp
+++ b/control/json/utils/modifier.cpp
@@ -50,9 +50,9 @@
* @brief Return a default value to use when the argument passed
* to LessThanOperator is out of range.
*/
-PropertyVariantType
- getDefaultValue(const PropertyVariantType& val,
- const std::optional<PropertyVariantType>& defaultValue)
+PropertyVariantType getDefaultValue(
+ const PropertyVariantType& val,
+ const std::optional<PropertyVariantType>& defaultValue)
{
// When a default value is given, return that
if (defaultValue)
diff --git a/control/json/utils/pcie_card_metadata.hpp b/control/json/utils/pcie_card_metadata.hpp
index dcdc9e5..c04443d 100644
--- a/control/json/utils/pcie_card_metadata.hpp
+++ b/control/json/utils/pcie_card_metadata.hpp
@@ -83,9 +83,9 @@
*
* If no entry is found, it will return std::nullopt.
*/
- std::optional<std::variant<int32_t, bool>>
- lookup(uint16_t deviceID, uint16_t vendorID, uint16_t subsystemID,
- uint16_t subsystemVendorID) const;
+ std::optional<std::variant<int32_t, bool>> lookup(
+ uint16_t deviceID, uint16_t vendorID, uint16_t subsystemID,
+ uint16_t subsystemVendorID) const;
private:
/**
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index 8dc6044..ca78900 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -558,8 +558,8 @@
{
// Get a set property handler function for the configured values of the
// "Supported" property
-std::function<void(DBusZone&, Zone&)>
- supported(const json& jsonObj, bool persist)
+std::function<void(DBusZone&, Zone&)> supported(const json& jsonObj,
+ bool persist)
{
std::vector<std::string> values;
if (!jsonObj.contains("values"))
diff --git a/control/json/zone.hpp b/control/json/zone.hpp
index bb00416..5c37c4a 100644
--- a/control/json/zone.hpp
+++ b/control/json/zone.hpp
@@ -551,8 +551,8 @@
*
* @return Zone dbus object's set property function for the "Supported" property
*/
-std::function<void(DBusZone&, Zone&)>
- supported(const json& jsonObj, bool persist);
+std::function<void(DBusZone&, Zone&)> supported(const json& jsonObj,
+ bool persist);
/**
* @brief "Current" property on the "xyz.openbmc_project.Control.ThermalMode"
@@ -564,8 +564,8 @@
*
* @return Zone dbus object's set property function for the "Current" property
*/
-std::function<void(DBusZone&, Zone&)>
- current(const json& jsonObj, bool persist);
+std::function<void(DBusZone&, Zone&)> current(const json& jsonObj,
+ bool persist);
} // namespace zone::property
diff --git a/monitor/fan_error.cpp b/monitor/fan_error.cpp
index 6d0ef20..ed8340d 100644
--- a/monitor/fan_error.cpp
+++ b/monitor/fan_error.cpp
@@ -126,8 +126,8 @@
}
}
-std::map<std::string, std::string>
- FanError::getAdditionalData(bool isPowerOffError)
+std::map<std::string, std::string> FanError::getAdditionalData(
+ bool isPowerOffError)
{
std::map<std::string, std::string> ad;
diff --git a/monitor/json_parser.cpp b/monitor/json_parser.cpp
index 5faccb4..588cdd8 100644
--- a/monitor/json_parser.cpp
+++ b/monitor/json_parser.cpp
@@ -43,8 +43,8 @@
{
// Get a constructed trust group class for a non-zero speed group
-CreateGroupFunction
- getNonZeroSpeed(const std::vector<trust::GroupDefinition>& group)
+CreateGroupFunction getNonZeroSpeed(
+ const std::vector<trust::GroupDefinition>& group)
{
return [group]() {
return std::make_unique<trust::NonzeroSpeed>(std::move(group));
@@ -463,10 +463,10 @@
return cause;
}
-std::unique_ptr<PowerOffAction>
- getPowerOffAction(const json& powerOffConfig,
- std::shared_ptr<PowerInterfaceBase>& powerInterface,
- PowerOffAction::PrePowerOffFunc& func)
+std::unique_ptr<PowerOffAction> getPowerOffAction(
+ const json& powerOffConfig,
+ std::shared_ptr<PowerInterfaceBase>& powerInterface,
+ PowerOffAction::PrePowerOffFunc& func)
{
std::unique_ptr<PowerOffAction> action;
if (!powerOffConfig.contains("type"))
diff --git a/monitor/power_off_cause.hpp b/monitor/power_off_cause.hpp
index abc2cb4..c0304c0 100644
--- a/monitor/power_off_cause.hpp
+++ b/monitor/power_off_cause.hpp
@@ -179,11 +179,11 @@
~FanFRUsWithNonfuncRotorsCause() = default;
FanFRUsWithNonfuncRotorsCause(const FanFRUsWithNonfuncRotorsCause&) =
delete;
- FanFRUsWithNonfuncRotorsCause&
- operator=(const FanFRUsWithNonfuncRotorsCause&) = delete;
+ FanFRUsWithNonfuncRotorsCause& operator=(
+ const FanFRUsWithNonfuncRotorsCause&) = delete;
FanFRUsWithNonfuncRotorsCause(FanFRUsWithNonfuncRotorsCause&&) = delete;
- FanFRUsWithNonfuncRotorsCause&
- operator=(FanFRUsWithNonfuncRotorsCause&&) = delete;
+ FanFRUsWithNonfuncRotorsCause& operator=(FanFRUsWithNonfuncRotorsCause&&) =
+ delete;
/**
* @brief Constructor
diff --git a/monitor/system.cpp b/monitor/system.cpp
index 476a7f1..a4434dc 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -240,8 +240,8 @@
}
}
-const std::vector<CreateGroupFunction>
- System::getTrustGroups([[maybe_unused]] const json& jsonObj)
+const std::vector<CreateGroupFunction> System::getTrustGroups(
+ [[maybe_unused]] const json& jsonObj)
{
#ifdef MONITOR_USE_JSON
return getTrustGrps(jsonObj);
@@ -255,8 +255,8 @@
_trust = std::make_unique<trust::Manager>(groupFuncs);
}
-const std::vector<FanDefinition>
- System::getFanDefinitions([[maybe_unused]] const json& jsonObj)
+const std::vector<FanDefinition> System::getFanDefinitions(
+ [[maybe_unused]] const json& jsonObj)
{
#ifdef MONITOR_USE_JSON
return getFanDefs(jsonObj);
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 68c58a2..d26b246 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -54,9 +54,10 @@
* @param[out] value - filled in with the property value
*/
template <typename T>
-static void
- readProperty(const std::string& interface, const std::string& propertyName,
- const std::string& path, sdbusplus::bus_t& bus, T& value)
+static void readProperty(const std::string& interface,
+ const std::string& propertyName,
+ const std::string& path, sdbusplus::bus_t& bus,
+ T& value)
{
try
{
diff --git a/presence/json_parser.cpp b/presence/json_parser.cpp
index d5705ef..ffcb014 100644
--- a/presence/json_parser.cpp
+++ b/presence/json_parser.cpp
@@ -221,9 +221,9 @@
}
}
-std::unique_ptr<RedundancyPolicy>
- JsonConfig::getPolicy(const json& rpolicy, const fanPolicy& fpolicy,
- std::unique_ptr<EEPROMDevice> eepromDevice)
+std::unique_ptr<RedundancyPolicy> JsonConfig::getPolicy(
+ const json& rpolicy, const fanPolicy& fpolicy,
+ std::unique_ptr<EEPROMDevice> eepromDevice)
{
if (!rpolicy.contains("type"))
{
@@ -349,8 +349,8 @@
namespace rpolicy
{
// Get an `Anyof` redundancy policy for the fan
-std::unique_ptr<RedundancyPolicy>
- getAnyof(const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice)
+std::unique_ptr<RedundancyPolicy> getAnyof(
+ const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice)
{
std::vector<std::reference_wrapper<PresenceSensor>> pSensors;
for (auto& fanSensor : std::get<fanPolicySensorListPos>(fan))
diff --git a/presence/json_parser.hpp b/presence/json_parser.hpp
index 1e23380..56583ec 100644
--- a/presence/json_parser.hpp
+++ b/presence/json_parser.hpp
@@ -127,9 +127,9 @@
*
* @return - The constructed redundancy policy type for the fan
*/
- std::unique_ptr<RedundancyPolicy>
- getPolicy(const json& rpolicy, const fanPolicy& fpolicy,
- std::unique_ptr<EEPROMDevice> eepromDevice);
+ std::unique_ptr<RedundancyPolicy> getPolicy(
+ const json& rpolicy, const fanPolicy& fpolicy,
+ std::unique_ptr<EEPROMDevice> eepromDevice);
};
/**
@@ -173,8 +173,8 @@
*
* @return - An `Anyof` redundancy policy
*/
-std::unique_ptr<RedundancyPolicy>
- getAnyof(const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice);
+std::unique_ptr<RedundancyPolicy> getAnyof(
+ const fanPolicy& fan, std::unique_ptr<EEPROMDevice> eepromDevice);
/**
* @brief Create a `Fallback` redundancy policy on the created presence
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index 4068923..52c2a7e 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -153,10 +153,10 @@
/** @brief Invoke a method and read the response. */
template <typename Ret, typename... Args>
- static auto
- callMethodAndRead(sdbusplus::bus_t& bus, const std::string& busName,
- const std::string& path, const std::string& interface,
- const std::string& method, Args&&... args)
+ static auto callMethodAndRead(
+ sdbusplus::bus_t& bus, const std::string& busName,
+ const std::string& path, const std::string& interface,
+ const std::string& method, Args&&... args)
{
sdbusplus::message_t respMsg = callMethod<Args...>(
bus, busName, path, interface, method, std::forward<Args>(args)...);
diff --git a/sensor-monitor/shutdown_alarm_monitor.cpp b/sensor-monitor/shutdown_alarm_monitor.cpp
index 9b51a8b..1cdb547 100644
--- a/sensor-monitor/shutdown_alarm_monitor.cpp
+++ b/sensor-monitor/shutdown_alarm_monitor.cpp
@@ -467,8 +467,8 @@
"Create", errorName, convertForMessage(severity), ad);
}
-std::optional<ShutdownType>
- ShutdownAlarmMonitor::getShutdownType(const std::string& interface) const
+std::optional<ShutdownType> ShutdownAlarmMonitor::getShutdownType(
+ const std::string& interface) const
{
auto it = std::find_if(
shutdownInterfaces.begin(), shutdownInterfaces.end(),
diff --git a/sensor-monitor/shutdown_alarm_monitor.hpp b/sensor-monitor/shutdown_alarm_monitor.hpp
index f9162f6..0d990fa 100644
--- a/sensor-monitor/shutdown_alarm_monitor.hpp
+++ b/sensor-monitor/shutdown_alarm_monitor.hpp
@@ -145,8 +145,8 @@
* @return The interface, or std::nullopt if the interface isn't one
* of the shutdown interfaces.
*/
- std::optional<ShutdownType>
- getShutdownType(const std::string& interface) const;
+ std::optional<ShutdownType> getShutdownType(
+ const std::string& interface) const;
/**
* @brief Creates a phosphor-logging event log