Skip to content

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 10, 2024
1 parent c05dbef commit 2e7ddf9
Show file tree
Hide file tree
Showing 36 changed files with 111 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ struct RelayHandle {
HAL_RelayHandle handle = 0;
};

#define ASSERT_LAST_ERROR_STATUS(status, x) \
do { \
ASSERT_EQ(status, HAL_USE_LAST_ERROR); \
[[maybe_unused]] \
const char* lastErrorMessageInMacro = HAL_GetLastError(&status); \
ASSERT_EQ(status, x); \
#define ASSERT_LAST_ERROR_STATUS(status, x) \
do { \
ASSERT_EQ(status, HAL_USE_LAST_ERROR); \
[[maybe_unused]] const char* lastErrorMessageInMacro = \
HAL_GetLastError(&status); \
ASSERT_EQ(status, x); \
} while (0)

} // namespace hlt
7 changes: 5 additions & 2 deletions cscore/src/main/native/cpp/MjpegServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ void MjpegServerImpl::ConnThread::SendHTML(wpi::raw_ostream& os,

os << "<p>Supported Video Modes:</p>\n";
os << "<table cols=\"4\" style=\"border: 1px solid black\">\n";
os << "<tr><th>Pixel Format</th>" << "<th>Width</th>" << "<th>Height</th>"
os << "<tr><th>Pixel Format</th>"
<< "<th>Width</th>"
<< "<th>Height</th>"
<< "<th>FPS</th></tr>";
for (auto mode : source.EnumerateVideoModes(&status)) {
os << "<tr><td>";
Expand Down Expand Up @@ -879,7 +881,8 @@ void MjpegServerImpl::ConnThread::ProcessRequest() {
ProcessCommand(os, *source, parameters, true);
} else {
SendHeader(os, 200, "OK", "text/plain");
os << "Ignored due to no connected source." << "\r\n";
os << "Ignored due to no connected source."
<< "\r\n";
SDEBUG("Ignored due to no connected source.");
}
break;
Expand Down
3 changes: 2 additions & 1 deletion ntcore/src/main/native/cpp/NetworkServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ NetworkServer::NetworkServer(std::string_view persistentFilename,
HandleLocal();

// load persistent file first, then initialize
uv::QueueWork(m_loop, [this] { LoadPersistent(); }, [this] { Init(); });
uv::QueueWork(
m_loop, [this] { LoadPersistent(); }, [this] { Init(); });
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ class StructArraySubscriber : public Subscriber {

private:
ValueType m_defaultValue;
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

/**
Expand Down Expand Up @@ -388,8 +387,7 @@ class StructArrayPublisher : public Publisher {
private:
wpi::StructArrayBuffer<T, I...> m_buf;
std::atomic_bool m_schemaPublished{false};
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

/**
Expand Down Expand Up @@ -704,8 +702,7 @@ class StructArrayTopic final : public Topic {
}

private:
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

} // namespace nt
9 changes: 3 additions & 6 deletions ntcore/src/main/native/include/networktables/StructTopic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ class StructSubscriber : public Subscriber {

private:
ValueType m_defaultValue;
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

/**
Expand Down Expand Up @@ -302,8 +301,7 @@ class StructPublisher : public Publisher {

private:
std::atomic_bool m_schemaPublished{false};
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

/**
Expand Down Expand Up @@ -524,8 +522,7 @@ class StructTopic final : public Topic {
}

private:
[[no_unique_address]]
std::tuple<I...> m_info;
[[no_unique_address]] std::tuple<I...> m_info;
};

} // namespace nt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ std::optional<std::string> Command::GetPreviousCompositionSite() const {

void Command::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Command");
builder.AddStringProperty(".name", [this] { return GetName(); }, nullptr);
builder.AddStringProperty(
".name", [this] { return GetName(); }, nullptr);
builder.AddBooleanProperty(
"running", [this] { return IsScheduled(); },
[this](bool value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace frc2 {
*/
class [[deprecated("Use Command instead")]] CommandBase : public Command {
protected:
[[deprecated("Use Command instead")]]
CommandBase();
[[deprecated("Use Command instead")]] CommandBase();
};
} // namespace frc2
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ class TrapezoidProfileCommand
*/
[[deprecated(
"The new constructor allows you to pass in a supplier for desired and "
"current state. This allows you to change goals at runtime.")]]
TrapezoidProfileCommand(frc::TrapezoidProfile<Distance> profile,
std::function<void(State)> output,
Requirements requirements = {})
"current state. This allows you to change goals at "
"runtime.")]] TrapezoidProfileCommand(frc::TrapezoidProfile<Distance>
profile,
std::function<void(State)> output,
Requirements requirements = {})
: m_profile(profile), m_output(output) {
this->AddRequirements(requirements);
m_newAPI = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ std::vector<CommonType> make_vector(Args&&... args) {
vec.reserve(sizeof...(Args));

using arr_t = int[];
[[maybe_unused]]
arr_t arr{0, (vec.emplace_back(std::forward<Args>(args)), 0)...};
[[maybe_unused]] arr_t arr{
0, (vec.emplace_back(std::forward<Args>(args)), 0)...};

return vec;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ TEST_F(SysIdRoutineTest, OutputCorrectVoltage) {
TEST_F(SysIdRoutineTest, EmptyLogFunc) {
RunCommand(std::move(m_emptyRoutineForward));
SUCCEED();
}
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,6 @@ int ADXRS450_Gyro::GetPort() const {

void ADXRS450_Gyro::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Gyro");
builder.AddDoubleProperty("Value", [=, this] { return GetAngle(); }, nullptr);
builder.AddDoubleProperty(
"Value", [=, this] { return GetAngle(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/AnalogGyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@ std::shared_ptr<AnalogInput> AnalogGyro::GetAnalogInput() const {

void AnalogGyro::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Gyro");
builder.AddDoubleProperty("Value", [=, this] { return GetAngle(); }, nullptr);
builder.AddDoubleProperty(
"Value", [=, this] { return GetAngle(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ double AnalogPotentiometer::Get() const {

void AnalogPotentiometer::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Analog Input");
builder.AddDoubleProperty("Value", [=, this] { return Get(); }, nullptr);
builder.AddDoubleProperty(
"Value", [=, this] { return Get(); }, nullptr);
}
9 changes: 6 additions & 3 deletions wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ double BuiltInAccelerometer::GetZ() {

void BuiltInAccelerometer::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("3AxisAccelerometer");
builder.AddDoubleProperty("X", [=, this] { return GetX(); }, nullptr);
builder.AddDoubleProperty("Y", [=, this] { return GetY(); }, nullptr);
builder.AddDoubleProperty("Z", [=, this] { return GetZ(); }, nullptr);
builder.AddDoubleProperty(
"X", [=, this] { return GetX(); }, nullptr);
builder.AddDoubleProperty(
"Y", [=, this] { return GetY(); }, nullptr);
builder.AddDoubleProperty(
"Z", [=, this] { return GetZ(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/Counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,6 @@ bool Counter::GetDirection() const {

void Counter::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Counter");
builder.AddDoubleProperty("Value", [=, this] { return Get(); }, nullptr);
builder.AddDoubleProperty(
"Value", [=, this] { return Get(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/DigitalInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ int DigitalInput::GetChannel() const {

void DigitalInput::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Digital Input");
builder.AddBooleanProperty("Value", [=, this] { return Get(); }, nullptr);
builder.AddBooleanProperty(
"Value", [=, this] { return Get(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ void Encoder::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("Encoder");
}

builder.AddDoubleProperty("Speed", [=, this] { return GetRate(); }, nullptr);
builder.AddDoubleProperty(
"Speed", [=, this] { return GetRate(); }, nullptr);
builder.AddDoubleProperty(
"Distance", [=, this] { return GetDistance(); }, nullptr);
builder.AddDoubleProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ void ExternalDirectionCounter::SetEdgeConfiguration(

void ExternalDirectionCounter::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("External Direction Counter");
builder.AddDoubleProperty("Count", [&] { return GetCount(); }, nullptr);
builder.AddDoubleProperty(
"Count", [&] { return GetCount(); }, nullptr);
}
3 changes: 2 additions & 1 deletion wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ void UpDownCounter::SetDownEdgeConfiguration(EdgeConfiguration configuration) {

void UpDownCounter::InitSendable(wpi::SendableBuilder& builder) {
builder.SetSmartDashboardType("UpDown Counter");
builder.AddDoubleProperty("Count", [&] { return GetCount(); }, nullptr);
builder.AddDoubleProperty(
"Count", [&] { return GetCount(); }, nullptr);
}
3 changes: 1 addition & 2 deletions wpilibc/src/test/native/cpp/util/Color8BitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ TEST(Color8BitTest, ToHexString) {
EXPECT_EQ("#FF8040", color1.HexString());

// Ensure conversion to std::string works
[[maybe_unused]]
std::string str = color1.HexString();
[[maybe_unused]] std::string str = color1.HexString();

frc::Color8Bit color2{255, 128, 64};
EXPECT_EQ("#FF8040", color2.HexString());
Expand Down
3 changes: 1 addition & 2 deletions wpilibc/src/test/native/cpp/util/ColorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ TEST(ColorTest, ToHexString) {
EXPECT_EQ("#FF8040", color1.HexString());

// Ensure conversion to std::string works
[[maybe_unused]]
std::string str = color1.HexString();
[[maybe_unused]] std::string str = color1.HexString();

frc::Color color2{255, 128, 64};
EXPECT_EQ("#FF8040", color2.HexString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ TEST(PreferencesTest, ReadPreferencesFromFile) {
<< "\"properties\":{\"persistent\":true}}," << std::endl;
preferencesFile << "{\"type\":\"int\","
<< "\"name\":\"/Preferences/testFileGetInt\","
<< "\"value\":1," << "\"properties\":{\"persistent\":true}},"
<< std::endl;
<< "\"value\":1,"
<< "\"properties\":{\"persistent\":true}}," << std::endl;
preferencesFile << "{\"type\":\"double\","
<< "\"name\":\"/Preferences/testFileGetDouble\","
<< "\"value\":0.5,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void BangBangController::InitSendable(wpi::SendableBuilder& builder) {
[this](double setpoint) { SetSetpoint(setpoint); });
builder.AddDoubleProperty(
"measurement", [this] { return GetMeasurement(); }, nullptr);
builder.AddDoubleProperty("error", [this] { return GetError(); }, nullptr);
builder.AddDoubleProperty(
"error", [this] { return GetError(); }, nullptr);
builder.AddBooleanProperty(
"atSetpoint", [this] { return AtSetpoint(); }, nullptr);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ namespace {
class State {
public:
/// X position in global coordinate frame.
[[maybe_unused]]
static constexpr int kX = 0;
[[maybe_unused]] static constexpr int kX = 0;

/// Y position in global coordinate frame.
static constexpr int kY = 1;
Expand All @@ -34,12 +33,10 @@ class State {
static constexpr int kHeading = 2;

/// Left encoder velocity.
[[maybe_unused]]
static constexpr int kLeftVelocity = 3;
[[maybe_unused]] static constexpr int kLeftVelocity = 3;

/// Right encoder velocity.
[[maybe_unused]]
static constexpr int kRightVelocity = 4;
[[maybe_unused]] static constexpr int kRightVelocity = 4;
};

} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ namespace {
class State {
public:
/// X position in global coordinate frame.
[[maybe_unused]]
static constexpr int kX = 0;
[[maybe_unused]] static constexpr int kX = 0;

/// Y position in global coordinate frame.
static constexpr int kY = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class TrapezoidProfile {
[[deprecated(
"Pass the desired and current state into calculate instead of "
"constructing a new TrapezoidProfile with the desired and current "
"state")]]
TrapezoidProfile(Constraints constraints, State goal,
State initial = State{Distance_t{0}, Velocity_t{0}});
"state")]] TrapezoidProfile(Constraints constraints, State goal,
State initial = State{Distance_t{0},
Velocity_t{0}});

TrapezoidProfile(const TrapezoidProfile&) = default;
TrapezoidProfile& operator=(const TrapezoidProfile&) = default;
Expand Down
13 changes: 6 additions & 7 deletions wpimath/src/main/native/include/units/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,10 @@ constexpr dimensionless::scalar_t log2(const ScalarUnit x) noexcept {
template <
class UnitType,
std::enable_if_t<units::traits::has_linear_scale<UnitType>::value, int> = 0>
inline constexpr auto sqrt(const UnitType& value) noexcept
-> unit_t<
square_root<typename units::traits::unit_t_traits<UnitType>::unit_type>,
typename units::traits::unit_t_traits<UnitType>::underlying_type,
linear_scale> {
inline constexpr auto sqrt(const UnitType& value) noexcept -> unit_t<
square_root<typename units::traits::unit_t_traits<UnitType>::unit_type>,
typename units::traits::unit_t_traits<UnitType>::underlying_type,
linear_scale> {
return unit_t<
square_root<typename units::traits::unit_t_traits<UnitType>::unit_type>,
typename units::traits::unit_t_traits<UnitType>::underlying_type,
Expand Down Expand Up @@ -742,8 +741,8 @@ template <class UnitTypeLhs, class UnitMultiply, class UnitAdd,
class = std::enable_if_t<traits::is_unit_t<UnitTypeLhs>::value &&
traits::is_unit_t<UnitMultiply>::value &&
traits::is_unit_t<UnitAdd>::value>>
auto fma(const UnitTypeLhs x, const UnitMultiply y,
const UnitAdd z) noexcept -> decltype(x * y) {
auto fma(const UnitTypeLhs x, const UnitMultiply y, const UnitAdd z) noexcept
-> decltype(x * y) {
using resultType = decltype(x * y);
static_assert(
traits::is_convertible_unit_t<
Expand Down
7 changes: 3 additions & 4 deletions wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ TEST(StateSpaceUtilTest, CovArray) {
}

TEST(StateSpaceUtilTest, WhiteNoiseVectorParameterPack) {
[[maybe_unused]]
frc::Vectord<2> vec = frc::MakeWhiteNoiseVector(2.0, 3.0);
[[maybe_unused]] frc::Vectord<2> vec = frc::MakeWhiteNoiseVector(2.0, 3.0);
}

TEST(StateSpaceUtilTest, WhiteNoiseVectorArray) {
[[maybe_unused]]
frc::Vectord<2> vec = frc::MakeWhiteNoiseVector<2>({2.0, 3.0});
[[maybe_unused]] frc::Vectord<2> vec =
frc::MakeWhiteNoiseVector<2>({2.0, 3.0});
}

TEST(StateSpaceUtilTest, IsStabilizable) {
Expand Down
Loading

0 comments on commit 2e7ddf9

Please sign in to comment.