Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Upgrade to wpiformat 2024.33 #6449

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ AlignConsecutiveMacros:
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Expand Down Expand Up @@ -141,6 +146,7 @@ IntegerLiteralSeparator:
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
Expand Down Expand Up @@ -201,6 +207,7 @@ RawStringFormats:
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
Expand All @@ -218,6 +225,7 @@ SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
Expand All @@ -232,23 +240,28 @@ SpaceBeforeParensOptions:
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.32
run: pip3 install wpiformat==2024.33
- name: Run
run: wpiformat
- name: Check output
Expand Down
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: 2 additions & 5 deletions cscore/src/main/native/cpp/MjpegServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ 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 @@ -881,8 +879,7 @@ 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
4 changes: 1 addition & 3 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,10 @@ doxygen {
warn_if_undocumented false
warn_no_paramdoc true

//enable doxygen preprocessor expansion of WPI_DEPRECATED to fix MotorController docs
enable_preprocessing true
macro_expansion true
expand_only_predef true
predefined "WPI_DEPRECATED(x)=[[deprecated(x)]]\"\\\n" +
"\"__cplusplus\"\\\n" +
predefined "__cplusplus\"\\\n" +
"\"HAL_ENUM(name)=enum name : int32_t"

if (project.hasProperty('docWarningsAsErrors')) {
Expand Down
3 changes: 1 addition & 2 deletions ntcore/src/main/native/cpp/NetworkServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,7 @@ 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,7 +228,8 @@ 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 @@ -387,7 +388,8 @@ 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 @@ -702,7 +704,8 @@ 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: 6 additions & 3 deletions ntcore/src/main/native/include/networktables/StructTopic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ 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 @@ -301,7 +302,8 @@ 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 @@ -522,7 +524,8 @@ 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,8 +174,7 @@ 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 @@ -4,8 +4,6 @@

#pragma once

#include <wpi/deprecated.h>

#include "frc2/command/Command.h"

namespace frc2 {
Expand All @@ -19,7 +17,7 @@ namespace frc2 {
*/
class [[deprecated("Use Command instead")]] CommandBase : public Command {
protected:
WPI_DEPRECATED("Use Command instead")
[[deprecated("Use Command instead")]]
CommandBase();
};
} // namespace frc2
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <memory>
#include <utility>

#include <wpi/deprecated.h>

#include "frc2/command/Command.h"
#include "frc2/command/CommandPtr.h"

Expand All @@ -36,8 +34,9 @@ class CommandHelper : public Base {
}

protected:
WPI_DEPRECATED("Use ToPtr() instead")
std::unique_ptr<Command> TransferOwnership() && override {
[[deprecated("Use ToPtr() instead")]]
std::unique_ptr<Command> TransferOwnership() &&
override {
return std::make_unique<CRTP>(std::move(*static_cast<CRTP*>(this)));
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <utility>
#include <vector>

#include <wpi/deprecated.h>
#include <wpi/sendable/SendableBuilder.h>

#include "frc2/command/Command.h"
Expand Down Expand Up @@ -135,8 +134,9 @@ class SelectCommand : public CommandHelper<Command, SelectCommand<Key>> {
}

protected:
WPI_DEPRECATED("Use ToPtr() instead")
std::unique_ptr<Command> TransferOwnership() && override {
[[deprecated("Use ToPtr() instead")]]
std::unique_ptr<Command> TransferOwnership() &&
override {
return std::make_unique<SelectCommand>(std::move(*this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ 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.
*/
WPI_DEPRECATED(
[[deprecated(
"The new constructor allows you to pass in a supplier for desired and "
"current state. This allows you to change goals at runtime.")
"current state. This allows you to change goals at runtime.")]]
TrapezoidProfileCommand(frc::TrapezoidProfile<Distance> profile,
std::function<void(State)> output,
Requirements requirements = {})
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
3 changes: 1 addition & 2 deletions wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,5 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/AnalogGyro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,5 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ 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: 3 additions & 6 deletions wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/Counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,5 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/DigitalInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,5 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ 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,6 +98,5 @@ 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: 1 addition & 2 deletions wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,5 @@ 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: 2 additions & 1 deletion wpilibc/src/test/native/cpp/util/Color8BitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ 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: 2 additions & 1 deletion wpilibc/src/test/native/cpp/util/ColorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ 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
Loading
Loading