From 5370f249a1c86d859b16706b6b973e5ed836ba1b Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Mon, 18 Mar 2024 23:11:20 -0700 Subject: [PATCH] [build] Upgrade to wpiformat 2024.33 (#6449) This upgrades to clang-format and clang-tidy 18.1.1. This has the constructor attribute formatting fix, so we can remove our WPI_DEPRECATED macro. --- .clang-format | 21 ++++++++++++---- .github/workflows/lint-format.yml | 2 +- .../main/native/include/LifetimeWrappers.h | 12 +++++----- .../src/main/native/cpp/MjpegServerImpl.cpp | 7 ++---- docs/build.gradle | 4 +--- ntcore/src/main/native/cpp/NetworkServer.cpp | 3 +-- .../include/networktables/StructArrayTopic.h | 9 ++++--- .../include/networktables/StructTopic.h | 9 ++++--- .../main/native/cpp/frc2/command/Command.cpp | 3 +-- .../native/include/frc2/command/CommandBase.h | 4 +--- .../include/frc2/command/CommandHelper.h | 7 +++--- .../include/frc2/command/SelectCommand.h | 6 ++--- .../frc2/command/TrapezoidProfileCommand.h | 4 ++-- .../native/cpp/frc2/command/make_vector.h | 4 ++-- wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp | 3 +-- wpilibc/src/main/native/cpp/AnalogGyro.cpp | 3 +-- .../main/native/cpp/AnalogPotentiometer.cpp | 3 +-- .../main/native/cpp/BuiltInAccelerometer.cpp | 9 +++---- wpilibc/src/main/native/cpp/Counter.cpp | 3 +-- wpilibc/src/main/native/cpp/DigitalInput.cpp | 3 +-- wpilibc/src/main/native/cpp/Encoder.cpp | 3 +-- .../cpp/counter/ExternalDirectionCounter.cpp | 3 +-- .../main/native/cpp/counter/UpDownCounter.cpp | 3 +-- .../test/native/cpp/util/Color8BitTest.cpp | 3 ++- .../src/test/native/cpp/util/ColorTest.cpp | 3 ++- .../src/main/native/cpp/PreferencesTest.cpp | 4 ++-- .../cpp/controller/BangBangController.cpp | 3 +-- .../LTVDifferentialDriveController.cpp | 9 ++++--- .../cpp/controller/LTVUnicycleController.cpp | 3 ++- .../include/frc/filter/SlewRateLimiter.h | 1 - .../include/frc/trajectory/TrapezoidProfile.h | 6 ++--- wpimath/src/main/native/include/units/math.h | 13 +++++----- .../test/native/cpp/StateSpaceUtilTest.cpp | 7 +++--- .../test/native/cpp/uv/UvGetAddrInfoTest.cpp | 9 +++---- wpiutil/examples/writelog/writelog.cpp | 24 +++++++++---------- wpiutil/src/main/native/include/wpi/DataLog.h | 6 +++-- .../src/main/native/include/wpi/deprecated.h | 4 ---- .../src/main/native/include/wpi/jni_util.h | 4 ++-- wpiutil/src/test/native/cpp/ArrayTest.cpp | 15 +++++++----- wpiutil/src/test/native/cpp/Base64Test.cpp | 5 ++-- wpiutil/src/test/native/cpp/DataLogTest.cpp | 15 ++++++++---- .../src/test/native/cpp/spinlock_bench.cpp | 3 ++- .../src/main/native/cpp/xrp/XRPMotor.cpp | 2 -- 43 files changed, 135 insertions(+), 132 deletions(-) diff --git a/.clang-format b/.clang-format index 111b4a8e0e..d424ff940a 100644 --- a/.clang-format +++ b/.clang-format @@ -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: @@ -141,6 +146,7 @@ IntegerLiteralSeparator: JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLinesAtEOF: false LambdaBodyIndentation: Signature LineEnding: DeriveLF MacroBlockBegin: '' @@ -201,6 +207,7 @@ RawStringFormats: ReferenceAlignment: Pointer ReflowComments: true RemoveBracesLLVM: false +RemoveParentheses: Leave RemoveSemicolon: false RequiresClausePosition: OwnLine RequiresExpressionIndentation: OuterScope @@ -218,6 +225,7 @@ SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements SpaceBeforeParensOptions: AfterControlStatements: true @@ -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 diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index abff71e07f..519b55466d 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -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 diff --git a/crossConnIntegrationTests/src/main/native/include/LifetimeWrappers.h b/crossConnIntegrationTests/src/main/native/include/LifetimeWrappers.h index e196d84e77..7546bfa059 100644 --- a/crossConnIntegrationTests/src/main/native/include/LifetimeWrappers.h +++ b/crossConnIntegrationTests/src/main/native/include/LifetimeWrappers.h @@ -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 diff --git a/cscore/src/main/native/cpp/MjpegServerImpl.cpp b/cscore/src/main/native/cpp/MjpegServerImpl.cpp index c57dde57f9..b5900b41cd 100644 --- a/cscore/src/main/native/cpp/MjpegServerImpl.cpp +++ b/cscore/src/main/native/cpp/MjpegServerImpl.cpp @@ -438,9 +438,7 @@ void MjpegServerImpl::ConnThread::SendHTML(wpi::raw_ostream& os, os << "

Supported Video Modes:

\n"; os << "\n"; - os << "" - << "" - << "" + os << "" << "" << "" << ""; for (auto mode : source.EnumerateVideoModes(&status)) { os << "
Pixel FormatWidthHeight
Pixel FormatWidthHeightFPS
"; @@ -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; diff --git a/docs/build.gradle b/docs/build.gradle index 0d6e87487a..932ee3a4b4 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -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')) { diff --git a/ntcore/src/main/native/cpp/NetworkServer.cpp b/ntcore/src/main/native/cpp/NetworkServer.cpp index a6b2ae16d0..e98936a73b 100644 --- a/ntcore/src/main/native/cpp/NetworkServer.cpp +++ b/ntcore/src/main/native/cpp/NetworkServer.cpp @@ -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(); }); }); } diff --git a/ntcore/src/main/native/include/networktables/StructArrayTopic.h b/ntcore/src/main/native/include/networktables/StructArrayTopic.h index c4f0083688..009524a8bf 100644 --- a/ntcore/src/main/native/include/networktables/StructArrayTopic.h +++ b/ntcore/src/main/native/include/networktables/StructArrayTopic.h @@ -228,7 +228,8 @@ class StructArraySubscriber : public Subscriber { private: ValueType m_defaultValue; - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** @@ -387,7 +388,8 @@ class StructArrayPublisher : public Publisher { private: wpi::StructArrayBuffer m_buf; std::atomic_bool m_schemaPublished{false}; - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** @@ -702,7 +704,8 @@ class StructArrayTopic final : public Topic { } private: - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; } // namespace nt diff --git a/ntcore/src/main/native/include/networktables/StructTopic.h b/ntcore/src/main/native/include/networktables/StructTopic.h index b69d0af62b..7097dbc132 100644 --- a/ntcore/src/main/native/include/networktables/StructTopic.h +++ b/ntcore/src/main/native/include/networktables/StructTopic.h @@ -180,7 +180,8 @@ class StructSubscriber : public Subscriber { private: ValueType m_defaultValue; - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** @@ -301,7 +302,8 @@ class StructPublisher : public Publisher { private: std::atomic_bool m_schemaPublished{false}; - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** @@ -522,7 +524,8 @@ class StructTopic final : public Topic { } private: - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; } // namespace nt diff --git a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp index de673f2c41..b9183146c0 100644 --- a/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp +++ b/wpilibNewCommands/src/main/native/cpp/frc2/command/Command.cpp @@ -174,8 +174,7 @@ std::optional 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) { diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandBase.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandBase.h index ea24e42d97..d1067698db 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandBase.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandBase.h @@ -4,8 +4,6 @@ #pragma once -#include - #include "frc2/command/Command.h" namespace frc2 { @@ -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 diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h index ba6fe920b8..83451fe8dc 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandHelper.h @@ -8,8 +8,6 @@ #include #include -#include - #include "frc2/command/Command.h" #include "frc2/command/CommandPtr.h" @@ -36,8 +34,9 @@ class CommandHelper : public Base { } protected: - WPI_DEPRECATED("Use ToPtr() instead") - std::unique_ptr TransferOwnership() && override { + [[deprecated("Use ToPtr() instead")]] + std::unique_ptr TransferOwnership() && + override { return std::make_unique(std::move(*static_cast(this))); } }; diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h index cc311063b4..5eb8733219 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/SelectCommand.h @@ -17,7 +17,6 @@ #include #include -#include #include #include "frc2/command/Command.h" @@ -135,8 +134,9 @@ class SelectCommand : public CommandHelper> { } protected: - WPI_DEPRECATED("Use ToPtr() instead") - std::unique_ptr TransferOwnership() && override { + [[deprecated("Use ToPtr() instead")]] + std::unique_ptr TransferOwnership() && + override { return std::make_unique(std::move(*this)); } diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h index 289b1cb455..837dda3e09 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/TrapezoidProfileCommand.h @@ -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 profile, std::function output, Requirements requirements = {}) diff --git a/wpilibNewCommands/src/test/native/cpp/frc2/command/make_vector.h b/wpilibNewCommands/src/test/native/cpp/frc2/command/make_vector.h index 295eba7645..8dbf7544ac 100644 --- a/wpilibNewCommands/src/test/native/cpp/frc2/command/make_vector.h +++ b/wpilibNewCommands/src/test/native/cpp/frc2/command/make_vector.h @@ -24,8 +24,8 @@ std::vector make_vector(Args&&... args) { vec.reserve(sizeof...(Args)); using arr_t = int[]; - [[maybe_unused]] arr_t arr{ - 0, (vec.emplace_back(std::forward(args)), 0)...}; + [[maybe_unused]] + arr_t arr{0, (vec.emplace_back(std::forward(args)), 0)...}; return vec; } diff --git a/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp b/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp index c134b5c1ee..21e98e2ee3 100644 --- a/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp +++ b/wpilibc/src/main/native/cpp/ADXRS450_Gyro.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/AnalogGyro.cpp b/wpilibc/src/main/native/cpp/AnalogGyro.cpp index df6d33f458..8c0c4709c4 100644 --- a/wpilibc/src/main/native/cpp/AnalogGyro.cpp +++ b/wpilibc/src/main/native/cpp/AnalogGyro.cpp @@ -143,6 +143,5 @@ std::shared_ptr 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); } diff --git a/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp b/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp index d43c84fe75..d8b8b1e0a8 100644 --- a/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp +++ b/wpilibc/src/main/native/cpp/AnalogPotentiometer.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp b/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp index 857643b658..2189863241 100644 --- a/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp +++ b/wpilibc/src/main/native/cpp/BuiltInAccelerometer.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/Counter.cpp b/wpilibc/src/main/native/cpp/Counter.cpp index c33b69bef3..ab69f4ffde 100644 --- a/wpilibc/src/main/native/cpp/Counter.cpp +++ b/wpilibc/src/main/native/cpp/Counter.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/DigitalInput.cpp b/wpilibc/src/main/native/cpp/DigitalInput.cpp index 02757415de..e3f183dc65 100644 --- a/wpilibc/src/main/native/cpp/DigitalInput.cpp +++ b/wpilibc/src/main/native/cpp/DigitalInput.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/Encoder.cpp b/wpilibc/src/main/native/cpp/Encoder.cpp index c6440709ef..1e15ed87bb 100644 --- a/wpilibc/src/main/native/cpp/Encoder.cpp +++ b/wpilibc/src/main/native/cpp/Encoder.cpp @@ -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( diff --git a/wpilibc/src/main/native/cpp/counter/ExternalDirectionCounter.cpp b/wpilibc/src/main/native/cpp/counter/ExternalDirectionCounter.cpp index 24709aab32..071d55063b 100644 --- a/wpilibc/src/main/native/cpp/counter/ExternalDirectionCounter.cpp +++ b/wpilibc/src/main/native/cpp/counter/ExternalDirectionCounter.cpp @@ -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); } diff --git a/wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp b/wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp index 62537ee882..706b2d9673 100644 --- a/wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp +++ b/wpilibc/src/main/native/cpp/counter/UpDownCounter.cpp @@ -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); } diff --git a/wpilibc/src/test/native/cpp/util/Color8BitTest.cpp b/wpilibc/src/test/native/cpp/util/Color8BitTest.cpp index d9027be244..775b0a695a 100644 --- a/wpilibc/src/test/native/cpp/util/Color8BitTest.cpp +++ b/wpilibc/src/test/native/cpp/util/Color8BitTest.cpp @@ -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()); diff --git a/wpilibc/src/test/native/cpp/util/ColorTest.cpp b/wpilibc/src/test/native/cpp/util/ColorTest.cpp index cbde770758..a62c0157f1 100644 --- a/wpilibc/src/test/native/cpp/util/ColorTest.cpp +++ b/wpilibc/src/test/native/cpp/util/ColorTest.cpp @@ -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()); diff --git a/wpilibcIntegrationTests/src/main/native/cpp/PreferencesTest.cpp b/wpilibcIntegrationTests/src/main/native/cpp/PreferencesTest.cpp index ef58bb4bed..cdc8ecbd42 100644 --- a/wpilibcIntegrationTests/src/main/native/cpp/PreferencesTest.cpp +++ b/wpilibcIntegrationTests/src/main/native/cpp/PreferencesTest.cpp @@ -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," diff --git a/wpimath/src/main/native/cpp/controller/BangBangController.cpp b/wpimath/src/main/native/cpp/controller/BangBangController.cpp index 4a093d68c1..c60517a095 100644 --- a/wpimath/src/main/native/cpp/controller/BangBangController.cpp +++ b/wpimath/src/main/native/cpp/controller/BangBangController.cpp @@ -62,8 +62,7 @@ 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); } diff --git a/wpimath/src/main/native/cpp/controller/LTVDifferentialDriveController.cpp b/wpimath/src/main/native/cpp/controller/LTVDifferentialDriveController.cpp index 173f2ea7bd..e100c7f8c8 100644 --- a/wpimath/src/main/native/cpp/controller/LTVDifferentialDriveController.cpp +++ b/wpimath/src/main/native/cpp/controller/LTVDifferentialDriveController.cpp @@ -24,7 +24,8 @@ 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; @@ -33,10 +34,12 @@ 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 diff --git a/wpimath/src/main/native/cpp/controller/LTVUnicycleController.cpp b/wpimath/src/main/native/cpp/controller/LTVUnicycleController.cpp index aca317a4bb..505569981c 100644 --- a/wpimath/src/main/native/cpp/controller/LTVUnicycleController.cpp +++ b/wpimath/src/main/native/cpp/controller/LTVUnicycleController.cpp @@ -23,7 +23,8 @@ 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; diff --git a/wpimath/src/main/native/include/frc/filter/SlewRateLimiter.h b/wpimath/src/main/native/include/frc/filter/SlewRateLimiter.h index ceba4ca2bc..f04aac4855 100644 --- a/wpimath/src/main/native/include/frc/filter/SlewRateLimiter.h +++ b/wpimath/src/main/native/include/frc/filter/SlewRateLimiter.h @@ -6,7 +6,6 @@ #include -#include #include #include "units/time.h" diff --git a/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h b/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h index 79d22adfeb..15b101dfe8 100644 --- a/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h +++ b/wpimath/src/main/native/include/frc/trajectory/TrapezoidProfile.h @@ -4,8 +4,6 @@ #pragma once -#include - #include "units/time.h" #include "wpimath/MathShared.h" @@ -114,10 +112,10 @@ class TrapezoidProfile { * @deprecated Pass the desired and current state into calculate instead of * constructing a new TrapezoidProfile with the desired and current state */ - WPI_DEPRECATED( + [[deprecated( "Pass the desired and current state into calculate instead of " "constructing a new TrapezoidProfile with the desired and current " - "state") + "state")]] TrapezoidProfile(Constraints constraints, State goal, State initial = State{Distance_t{0}, Velocity_t{0}}); diff --git a/wpimath/src/main/native/include/units/math.h b/wpimath/src/main/native/include/units/math.h index 727aee62fb..a5cf357b5f 100644 --- a/wpimath/src/main/native/include/units/math.h +++ b/wpimath/src/main/native/include/units/math.h @@ -482,10 +482,11 @@ constexpr dimensionless::scalar_t log2(const ScalarUnit x) noexcept { template < class UnitType, std::enable_if_t::value, int> = 0> -inline constexpr auto sqrt(const UnitType& value) noexcept -> unit_t< - square_root::unit_type>, - typename units::traits::unit_t_traits::underlying_type, - linear_scale> { +inline constexpr auto sqrt(const UnitType& value) noexcept + -> unit_t< + square_root::unit_type>, + typename units::traits::unit_t_traits::underlying_type, + linear_scale> { return unit_t< square_root::unit_type>, typename units::traits::unit_t_traits::underlying_type, @@ -741,8 +742,8 @@ template ::value && traits::is_unit_t::value && traits::is_unit_t::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< diff --git a/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp b/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp index 4de13d3684..cce1137e46 100644 --- a/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp +++ b/wpimath/src/test/native/cpp/StateSpaceUtilTest.cpp @@ -63,12 +63,13 @@ 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) { diff --git a/wpinet/src/test/native/cpp/uv/UvGetAddrInfoTest.cpp b/wpinet/src/test/native/cpp/uv/UvGetAddrInfoTest.cpp index 78bb4c29c8..ac87737b74 100644 --- a/wpinet/src/test/native/cpp/uv/UvGetAddrInfoTest.cpp +++ b/wpinet/src/test/native/cpp/uv/UvGetAddrInfoTest.cpp @@ -42,8 +42,7 @@ TEST(UvGetAddrInfoTest, BothNull) { fail_cb_called++; }); - GetAddrInfo( - loop, [](const addrinfo&) { FAIL(); }, ""); + GetAddrInfo(loop, [](const addrinfo&) { FAIL(); }, ""); loop->Run(); ASSERT_EQ(fail_cb_called, 1); } @@ -59,8 +58,7 @@ TEST(UvGetAddrInfoTest, FailedLookup) { }); // Use a FQDN by ending in a period - GetAddrInfo( - loop, [](const addrinfo&) { FAIL(); }, "xyzzy.xyzzy.xyzzy."); + GetAddrInfo(loop, [](const addrinfo&) { FAIL(); }, "xyzzy.xyzzy.xyzzy."); loop->Run(); ASSERT_EQ(fail_cb_called, 1); } @@ -71,8 +69,7 @@ TEST(UvGetAddrInfoTest, Basic) { auto loop = Loop::Create(); loop->error.connect([](Error) { FAIL(); }); - GetAddrInfo( - loop, [&](const addrinfo&) { getaddrinfo_cbs++; }, "localhost"); + GetAddrInfo(loop, [&](const addrinfo&) { getaddrinfo_cbs++; }, "localhost"); loop->Run(); diff --git a/wpiutil/examples/writelog/writelog.cpp b/wpiutil/examples/writelog/writelog.cpp index bd5e14f441..3312de0763 100644 --- a/wpiutil/examples/writelog/writelog.cpp +++ b/wpiutil/examples/writelog/writelog.cpp @@ -50,19 +50,19 @@ int main(int argc, char** argv) { } }}); - testVec.push_back( - {"Double array append", [](auto& log) { - wpi::log::DoubleArrayLogEntry entry{log, "double_array", 1}; - entry.Append({1, 2, 3}, 20000); - entry.Append({4, 5}, 30000); - }}); + testVec.push_back({"Double array append", [](auto& log) { + wpi::log::DoubleArrayLogEntry entry{log, "double_array", + 1}; + entry.Append({1, 2, 3}, 20000); + entry.Append({4, 5}, 30000); + }}); - testVec.push_back( - {"String array append", [](auto& log) { - wpi::log::StringArrayLogEntry entry{log, "string_array", 1}; - entry.Append({"Hello", "World"}, 20000); - entry.Append({"This", "Is", "Fun"}, 30000); - }}); + testVec.push_back({"String array append", [](auto& log) { + wpi::log::StringArrayLogEntry entry{log, "string_array", + 1}; + entry.Append({"Hello", "World"}, 20000); + entry.Append({"This", "Is", "Fun"}, 30000); + }}); for (const auto& [name, fn] : testVec) { auto resVec = std::vector(); diff --git a/wpiutil/src/main/native/include/wpi/DataLog.h b/wpiutil/src/main/native/include/wpi/DataLog.h index 6187662c00..f6e4b3c7a1 100644 --- a/wpiutil/src/main/native/include/wpi/DataLog.h +++ b/wpiutil/src/main/native/include/wpi/DataLog.h @@ -991,7 +991,8 @@ class StructLogEntry : public DataLogEntry { } private: - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** @@ -1059,7 +1060,8 @@ class StructArrayLogEntry : public DataLogEntry { private: StructArrayBuffer m_buf; - [[no_unique_address]] std::tuple m_info; + [[no_unique_address]] + std::tuple m_info; }; /** diff --git a/wpiutil/src/main/native/include/wpi/deprecated.h b/wpiutil/src/main/native/include/wpi/deprecated.h index ccd6bbaa40..7947010aaf 100644 --- a/wpiutil/src/main/native/include/wpi/deprecated.h +++ b/wpiutil/src/main/native/include/wpi/deprecated.h @@ -5,10 +5,6 @@ #ifndef WPIUTIL_WPI_DEPRECATED_H_ #define WPIUTIL_WPI_DEPRECATED_H_ -#ifndef WPI_DEPRECATED -#define WPI_DEPRECATED(msg) [[deprecated(msg)]] -#endif - #ifndef WPI_IGNORE_DEPRECATED #ifdef __GNUC__ #define WPI_IGNORE_DEPRECATED \ diff --git a/wpiutil/src/main/native/include/wpi/jni_util.h b/wpiutil/src/main/native/include/wpi/jni_util.h index 31bdf93ed8..aabe54c0d8 100644 --- a/wpiutil/src/main/native/include/wpi/jni_util.h +++ b/wpiutil/src/main/native/include/wpi/jni_util.h @@ -225,8 +225,8 @@ using copy_cv_t = typename copy_cv::type; template constexpr bool is_qualification_convertible_v = - !(std::is_const_v && !std::is_const_v)&&!( - std::is_volatile_v && !std::is_volatile_v); + !(std::is_const_v && !std::is_const_v) && + !(std::is_volatile_v && !std::is_volatile_v); /** * Helper class for working with JNI arrays. diff --git a/wpiutil/src/test/native/cpp/ArrayTest.cpp b/wpiutil/src/test/native/cpp/ArrayTest.cpp index d3a12a4bb9..ccc86d4762 100644 --- a/wpiutil/src/test/native/cpp/ArrayTest.cpp +++ b/wpiutil/src/test/native/cpp/ArrayTest.cpp @@ -16,17 +16,20 @@ class MoveOnlyType { } // namespace TEST(ArrayTest, CopyableTypeCompiles) { - [[maybe_unused]] constexpr wpi::array arr1{1, 2, 3}; + [[maybe_unused]] + constexpr wpi::array arr1{1, 2, 3}; // Test deduction guide - [[maybe_unused]] constexpr wpi::array arr2{1, 2, 3}; + [[maybe_unused]] + constexpr wpi::array arr2{1, 2, 3}; } TEST(ArrayTest, MoveOnlyTypeCompiles) { - [[maybe_unused]] constexpr wpi::array arr1{ - MoveOnlyType{}, MoveOnlyType{}, MoveOnlyType{}}; + [[maybe_unused]] + constexpr wpi::array arr1{MoveOnlyType{}, MoveOnlyType{}, + MoveOnlyType{}}; // Test deduction guide - [[maybe_unused]] constexpr wpi::array arr2{MoveOnlyType{}, MoveOnlyType{}, - MoveOnlyType{}}; + [[maybe_unused]] + constexpr wpi::array arr2{MoveOnlyType{}, MoveOnlyType{}, MoveOnlyType{}}; } diff --git a/wpiutil/src/test/native/cpp/Base64Test.cpp b/wpiutil/src/test/native/cpp/Base64Test.cpp index 514bb55bf5..9db4349503 100644 --- a/wpiutil/src/test/native/cpp/Base64Test.cpp +++ b/wpiutil/src/test/native/cpp/Base64Test.cpp @@ -16,9 +16,8 @@ struct Base64TestParam { }; std::ostream& operator<<(std::ostream& os, const Base64TestParam& param) { - os << "Base64TestParam(Len: " << param.plain_len << ", " - << "Plain: \"" << param.plain << "\", " - << "Encoded: \"" << param.encoded << "\")"; + os << "Base64TestParam(Len: " << param.plain_len << ", " << "Plain: \"" + << param.plain << "\", " << "Encoded: \"" << param.encoded << "\")"; return os; } diff --git a/wpiutil/src/test/native/cpp/DataLogTest.cpp b/wpiutil/src/test/native/cpp/DataLogTest.cpp index d06ad339a3..dd0f3d12d7 100644 --- a/wpiutil/src/test/native/cpp/DataLogTest.cpp +++ b/wpiutil/src/test/native/cpp/DataLogTest.cpp @@ -131,7 +131,8 @@ TEST(DataLogTest, SimpleInt) { TEST(DataLogTest, StructA) { wpi::log::DataLog log{[](auto) {}}; - [[maybe_unused]] wpi::log::StructLogEntry entry0; + [[maybe_unused]] + wpi::log::StructLogEntry entry0; wpi::log::StructLogEntry entry{log, "a", 5}; entry.Append(ThingA{}); entry.Append(ThingA{}, 7); @@ -139,7 +140,8 @@ TEST(DataLogTest, StructA) { TEST(DataLogTest, StructArrayA) { wpi::log::DataLog log{[](auto) {}}; - [[maybe_unused]] wpi::log::StructArrayLogEntry entry0; + [[maybe_unused]] + wpi::log::StructArrayLogEntry entry0; wpi::log::StructArrayLogEntry entry{log, "a", 5}; entry.Append({{ThingA{}, ThingA{}}}); entry.Append({{ThingA{}, ThingA{}}}, 7); @@ -147,7 +149,8 @@ TEST(DataLogTest, StructArrayA) { TEST(DataLogTest, StructFixedArrayA) { wpi::log::DataLog log{[](auto) {}}; - [[maybe_unused]] wpi::log::StructArrayLogEntry> entry0; + [[maybe_unused]] + wpi::log::StructArrayLogEntry> entry0; wpi::log::StructLogEntry> entry{log, "a", 5}; std::array arr; entry.Append(arr); @@ -157,7 +160,8 @@ TEST(DataLogTest, StructFixedArrayA) { TEST(DataLogTest, StructB) { wpi::log::DataLog log{[](auto) {}}; Info1 info; - [[maybe_unused]] wpi::log::StructLogEntry entry0; + [[maybe_unused]] + wpi::log::StructLogEntry entry0; wpi::log::StructLogEntry entry{log, "b", info, 5}; entry.Append(ThingB{}); entry.Append(ThingB{}, 7); @@ -166,7 +170,8 @@ TEST(DataLogTest, StructB) { TEST(DataLogTest, StructArrayB) { wpi::log::DataLog log{[](auto) {}}; Info1 info; - [[maybe_unused]] wpi::log::StructArrayLogEntry entry0; + [[maybe_unused]] + wpi::log::StructArrayLogEntry entry0; wpi::log::StructArrayLogEntry entry{log, "a", info, 5}; entry.Append({{ThingB{}, ThingB{}}}); entry.Append({{ThingB{}, ThingB{}}}, 7); diff --git a/wpiutil/src/test/native/cpp/spinlock_bench.cpp b/wpiutil/src/test/native/cpp/spinlock_bench.cpp index c8af3d26ee..d74c1ad8c3 100644 --- a/wpiutil/src/test/native/cpp/spinlock_bench.cpp +++ b/wpiutil/src/test/native/cpp/spinlock_bench.cpp @@ -29,7 +29,8 @@ TEST(SpinlockTest, Benchmark) { // warmup std::thread thr([]() { - [[maybe_unused]] int value = 0; + [[maybe_unused]] + int value = 0; auto start = high_resolution_clock::now(); for (int i = 0; i < 10000000; i++) { diff --git a/xrpVendordep/src/main/native/cpp/xrp/XRPMotor.cpp b/xrpVendordep/src/main/native/cpp/xrp/XRPMotor.cpp index 6d16f7b6a1..91740798ae 100644 --- a/xrpVendordep/src/main/native/cpp/xrp/XRPMotor.cpp +++ b/xrpVendordep/src/main/native/cpp/xrp/XRPMotor.cpp @@ -6,8 +6,6 @@ #include -#include - using namespace frc; std::map XRPMotor::s_simDeviceMap = {