mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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.
This commit is contained in:
@@ -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
|
||||
|
||||
2
.github/workflows/lint-format.yml
vendored
2
.github/workflows/lint-format.yml
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>";
|
||||
@@ -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;
|
||||
|
||||
@@ -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')) {
|
||||
|
||||
@@ -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(); });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#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<Command> TransferOwnership() && override {
|
||||
[[deprecated("Use ToPtr() instead")]]
|
||||
std::unique_ptr<Command> TransferOwnership() &&
|
||||
override {
|
||||
return std::make_unique<CRTP>(std::move(*static_cast<CRTP*>(this)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc2/command/Command.h"
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = {})
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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,"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/timestamp.h>
|
||||
|
||||
#include "units/time.h"
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#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}});
|
||||
|
||||
|
||||
@@ -482,10 +482,11 @@ 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,
|
||||
@@ -741,8 +742,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<
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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<microseconds::rep>();
|
||||
|
||||
@@ -991,7 +991,8 @@ class StructLogEntry : public DataLogEntry {
|
||||
}
|
||||
|
||||
private:
|
||||
[[no_unique_address]] std::tuple<I...> m_info;
|
||||
[[no_unique_address]]
|
||||
std::tuple<I...> m_info;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1059,7 +1060,8 @@ class StructArrayLogEntry : public DataLogEntry {
|
||||
|
||||
private:
|
||||
StructArrayBuffer<T, I...> m_buf;
|
||||
[[no_unique_address]] std::tuple<I...> m_info;
|
||||
[[no_unique_address]]
|
||||
std::tuple<I...> m_info;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -225,8 +225,8 @@ using copy_cv_t = typename copy_cv<CvSrc, Dest>::type;
|
||||
|
||||
template <typename From, typename To>
|
||||
constexpr bool is_qualification_convertible_v =
|
||||
!(std::is_const_v<From> && !std::is_const_v<To>)&&!(
|
||||
std::is_volatile_v<From> && !std::is_volatile_v<To>);
|
||||
!(std::is_const_v<From> && !std::is_const_v<To>) &&
|
||||
!(std::is_volatile_v<From> && !std::is_volatile_v<To>);
|
||||
|
||||
/**
|
||||
* Helper class for working with JNI arrays.
|
||||
|
||||
@@ -16,17 +16,20 @@ class MoveOnlyType {
|
||||
} // namespace
|
||||
|
||||
TEST(ArrayTest, CopyableTypeCompiles) {
|
||||
[[maybe_unused]] constexpr wpi::array<int, 3> arr1{1, 2, 3};
|
||||
[[maybe_unused]]
|
||||
constexpr wpi::array<int, 3> 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<MoveOnlyType, 3> arr1{
|
||||
MoveOnlyType{}, MoveOnlyType{}, MoveOnlyType{}};
|
||||
[[maybe_unused]]
|
||||
constexpr wpi::array<MoveOnlyType, 3> 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{}};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ TEST(DataLogTest, SimpleInt) {
|
||||
|
||||
TEST(DataLogTest, StructA) {
|
||||
wpi::log::DataLog log{[](auto) {}};
|
||||
[[maybe_unused]] wpi::log::StructLogEntry<ThingA> entry0;
|
||||
[[maybe_unused]]
|
||||
wpi::log::StructLogEntry<ThingA> entry0;
|
||||
wpi::log::StructLogEntry<ThingA> 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<ThingA> entry0;
|
||||
[[maybe_unused]]
|
||||
wpi::log::StructArrayLogEntry<ThingA> entry0;
|
||||
wpi::log::StructArrayLogEntry<ThingA> 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<std::array<ThingA, 2>> entry0;
|
||||
[[maybe_unused]]
|
||||
wpi::log::StructArrayLogEntry<std::array<ThingA, 2>> entry0;
|
||||
wpi::log::StructLogEntry<std::array<ThingA, 2>> entry{log, "a", 5};
|
||||
std::array<ThingA, 2> 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<ThingB, Info1> entry0;
|
||||
[[maybe_unused]]
|
||||
wpi::log::StructLogEntry<ThingB, Info1> entry0;
|
||||
wpi::log::StructLogEntry<ThingB, Info1> 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<ThingB, Info1> entry0;
|
||||
[[maybe_unused]]
|
||||
wpi::log::StructArrayLogEntry<ThingB, Info1> entry0;
|
||||
wpi::log::StructArrayLogEntry<ThingB, Info1> entry{log, "a", info, 5};
|
||||
entry.Append({{ThingB{}, ThingB{}}});
|
||||
entry.Append({{ThingB{}, ThingB{}}}, 7);
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <frc/Errors.h>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
std::map<int, std::string> XRPMotor::s_simDeviceMap = {
|
||||
|
||||
Reference in New Issue
Block a user