clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: Id513ba4699f994d5bc2a8480c4a0b2659e9480ce
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/dbus/dbusutil.hpp b/dbus/dbusutil.hpp
index 49ec859..ff606a4 100644
--- a/dbus/dbusutil.hpp
+++ b/dbus/dbusutil.hpp
@@ -14,15 +14,15 @@
struct VariantToDoubleVisitor
{
template <typename T>
- std::enable_if_t<std::is_arithmetic<T>::value, double>
- operator()(const T& t) const
+ std::enable_if_t<std::is_arithmetic<T>::value, double> operator()(
+ const T& t) const
{
return static_cast<double>(t);
}
template <typename T>
- std::enable_if_t<!std::is_arithmetic<T>::value, double>
- operator()([[maybe_unused]] const T& t) const
+ std::enable_if_t<!std::is_arithmetic<T>::value, double> operator()(
+ [[maybe_unused]] const T& t) const
{
throw std::invalid_argument("Cannot translate type to double");
}
diff --git a/dbus/dbuswrite.hpp b/dbus/dbuswrite.hpp
index 9aec84c..3abb075 100644
--- a/dbus/dbuswrite.hpp
+++ b/dbus/dbuswrite.hpp
@@ -31,9 +31,9 @@
class DbusWritePercent : public WriteInterface
{
public:
- static std::unique_ptr<WriteInterface>
- createDbusWrite(const std::string& path, int64_t min, int64_t max,
- std::unique_ptr<DbusHelperInterface> helper);
+ static std::unique_ptr<WriteInterface> createDbusWrite(
+ const std::string& path, int64_t min, int64_t max,
+ std::unique_ptr<DbusHelperInterface> helper);
DbusWritePercent(const std::string& path, int64_t min, int64_t max,
const std::string& connectionName) :
@@ -52,9 +52,9 @@
class DbusWrite : public WriteInterface
{
public:
- static std::unique_ptr<WriteInterface>
- createDbusWrite(const std::string& path, int64_t min, int64_t max,
- std::unique_ptr<DbusHelperInterface> helper);
+ static std::unique_ptr<WriteInterface> createDbusWrite(
+ const std::string& path, int64_t min, int64_t max,
+ std::unique_ptr<DbusHelperInterface> helper);
DbusWrite(const std::string& path, int64_t min, int64_t max,
const std::string& connectionName) :
diff --git a/main.cpp b/main.cpp
index e91d109..7ade8e4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -83,10 +83,10 @@
/* buses for system control */
static sdbusplus::asio::connection modeControlBus(io);
-static sdbusplus::asio::connection
- hostBus(io, sdbusplus::bus::new_system().release());
-static sdbusplus::asio::connection
- passiveBus(io, sdbusplus::bus::new_system().release());
+static sdbusplus::asio::connection hostBus(
+ io, sdbusplus::bus::new_system().release());
+static sdbusplus::asio::connection passiveBus(
+ io, sdbusplus::bus::new_system().release());
namespace pid_control
{
diff --git a/pid/builder.cpp b/pid/builder.cpp
index 8a6bd39..1164355 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -50,10 +50,10 @@
return std::string(objectPath) + std::to_string(zone) + "/" + pidname;
}
-std::unordered_map<int64_t, std::shared_ptr<ZoneInterface>>
- buildZones(const std::map<int64_t, conf::PIDConf>& zonePids,
- std::map<int64_t, conf::ZoneConfig>& zoneConfigs,
- SensorManager& mgr, sdbusplus::bus_t& modeControlBus)
+std::unordered_map<int64_t, std::shared_ptr<ZoneInterface>> buildZones(
+ const std::map<int64_t, conf::PIDConf>& zonePids,
+ std::map<int64_t, conf::ZoneConfig>& zoneConfigs, SensorManager& mgr,
+ sdbusplus::bus_t& modeControlBus)
{
std::unordered_map<int64_t, std::shared_ptr<ZoneInterface>> zones;
diff --git a/pid/builder.hpp b/pid/builder.hpp
index dbfc229..acfc6dd 100644
--- a/pid/builder.hpp
+++ b/pid/builder.hpp
@@ -12,9 +12,9 @@
namespace pid_control
{
-std::unordered_map<int64_t, std::shared_ptr<ZoneInterface>>
- buildZones(const std::map<int64_t, conf::PIDConf>& zonePids,
- std::map<int64_t, conf::ZoneConfig>& zoneConfigs,
- SensorManager& mgr, sdbusplus::bus_t& modeControlBus);
+std::unordered_map<int64_t, std::shared_ptr<ZoneInterface>> buildZones(
+ const std::map<int64_t, conf::PIDConf>& zonePids,
+ std::map<int64_t, conf::ZoneConfig>& zoneConfigs, SensorManager& mgr,
+ sdbusplus::bus_t& modeControlBus);
}
diff --git a/pid/stepwisecontroller.hpp b/pid/stepwisecontroller.hpp
index 5a8dc3b..f1f7fe9 100644
--- a/pid/stepwisecontroller.hpp
+++ b/pid/stepwisecontroller.hpp
@@ -16,10 +16,10 @@
class StepwiseController : public Controller
{
public:
- static std::unique_ptr<Controller>
- createStepwiseController(ZoneInterface* owner, const std::string& id,
- const std::vector<std::string>& inputs,
- const ec::StepwiseInfo& initial);
+ static std::unique_ptr<Controller> createStepwiseController(
+ ZoneInterface* owner, const std::string& id,
+ const std::vector<std::string>& inputs,
+ const ec::StepwiseInfo& initial);
StepwiseController(const std::string& id,
const std::vector<std::string>& inputs,
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index 7c335c6..e71e9ce 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -42,9 +42,9 @@
static constexpr bool deferSignals = true;
-SensorManager
- buildSensors(const std::map<std::string, conf::SensorConfig>& config,
- sdbusplus::bus_t& passive, sdbusplus::bus_t& host)
+SensorManager buildSensors(
+ const std::map<std::string, conf::SensorConfig>& config,
+ sdbusplus::bus_t& passive, sdbusplus::bus_t& host)
{
SensorManager mgmr(passive, host);
auto& hostSensorBus = mgmr.getHostBus();
diff --git a/sensors/builder.hpp b/sensors/builder.hpp
index 14eabad..345da5d 100644
--- a/sensors/builder.hpp
+++ b/sensors/builder.hpp
@@ -15,8 +15,8 @@
/**
* Build the sensors and associate them with a SensorManager.
*/
-SensorManager
- buildSensors(const std::map<std::string, conf::SensorConfig>& config,
- sdbusplus::bus_t& passive, sdbusplus::bus_t& host);
+SensorManager buildSensors(
+ const std::map<std::string, conf::SensorConfig>& config,
+ sdbusplus::bus_t& passive, sdbusplus::bus_t& host);
} // namespace pid_control
diff --git a/sensors/buildjson.hpp b/sensors/buildjson.hpp
index 2075d30..4233cc0 100644
--- a/sensors/buildjson.hpp
+++ b/sensors/buildjson.hpp
@@ -20,7 +20,7 @@
* @param[in] data - the json data
* @return a map of sensors.
*/
-std::map<std::string, conf::SensorConfig>
- buildSensorsFromJson(const json& data);
+std::map<std::string, conf::SensorConfig> buildSensorsFromJson(
+ const json& data);
} // namespace pid_control
diff --git a/sensors/host.hpp b/sensors/host.hpp
index b97b137..170d94a 100644
--- a/sensors/host.hpp
+++ b/sensors/host.hpp
@@ -39,9 +39,9 @@
class HostSensor : public Sensor, public ValueObject
{
public:
- static std::unique_ptr<Sensor>
- createTemp(const std::string& name, int64_t timeout,
- sdbusplus::bus_t& bus, const char* objPath, bool defer);
+ static std::unique_ptr<Sensor> createTemp(
+ const std::string& name, int64_t timeout, sdbusplus::bus_t& bus,
+ const char* objPath, bool defer);
HostSensor(const std::string& name, int64_t timeout, sdbusplus::bus_t& bus,
const char* objPath, bool defer) :
diff --git a/util.cpp b/util.cpp
index b83ed43..de92772 100644
--- a/util.cpp
+++ b/util.cpp
@@ -101,10 +101,10 @@
std::cout << "}\n\n";
}
-std::vector<conf::SensorInput>
- spliceInputs(const std::vector<std::string>& inputNames,
- const std::vector<double>& inputTempToMargin,
- const std::vector<std::string>& missingAcceptableNames)
+std::vector<conf::SensorInput> spliceInputs(
+ const std::vector<std::string>& inputNames,
+ const std::vector<double>& inputTempToMargin,
+ const std::vector<std::string>& missingAcceptableNames)
{
std::vector<conf::SensorInput> results;
@@ -153,8 +153,8 @@
return results;
}
-std::vector<std::string>
- splitNames(const std::vector<conf::SensorInput>& sensorInputs)
+std::vector<std::string> splitNames(
+ const std::vector<conf::SensorInput>& sensorInputs)
{
std::vector<std::string> results;
diff --git a/util.hpp b/util.hpp
index 7617562..60dcfc1 100644
--- a/util.hpp
+++ b/util.hpp
@@ -44,16 +44,16 @@
* Splice together two vectors, "Inputs" and "TempToMargin" from JSON,
* into one vector of SensorInput structures containing info from both.
*/
-std::vector<conf::SensorInput>
- spliceInputs(const std::vector<std::string>& inputNames,
- const std::vector<double>& inputTempToMargin,
- const std::vector<std::string>& missingAcceptableNames);
+std::vector<conf::SensorInput> spliceInputs(
+ const std::vector<std::string>& inputNames,
+ const std::vector<double>& inputTempToMargin,
+ const std::vector<std::string>& missingAcceptableNames);
/*
* Recovers the original "Inputs" vector from spliceInputs().
*/
-std::vector<std::string>
- splitNames(const std::vector<conf::SensorInput>& sensorInputs);
+std::vector<std::string> splitNames(
+ const std::vector<conf::SensorInput>& sensorInputs);
/*
* Dump active configuration.