mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Replace WPI_DEPRECATED() macro with [[deprecated]] attribute (#5373)
Continue to use WPI_DEPRECATED macro for constructors until clang-format is fixed.
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
#include <units/time.h>
|
||||
#include <wpi/Demangle.h>
|
||||
#include <wpi/SmallSet.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/Subsystem.h"
|
||||
|
||||
@@ -161,8 +160,7 @@ class Command {
|
||||
* @return the command with the interrupt condition added
|
||||
* @deprecated Replace with Until()
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Until()")
|
||||
[[nodiscard]]
|
||||
[[deprecated("Replace with Until()")]] [[nodiscard]]
|
||||
CommandPtr WithInterrupt(std::function<bool()> condition) &&;
|
||||
|
||||
/**
|
||||
@@ -220,13 +218,13 @@ valid. This was unsafe/undefined behavior from the start, and RepeatCommand
|
||||
provides an easy way to achieve similar end results with slightly different (and
|
||||
safe) semantics.
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
[[deprecated(
|
||||
"PerpetualCommand violates the assumption that execute() doesn't get "
|
||||
"called after isFinished() returns true -- an assumption that should be "
|
||||
"valid."
|
||||
"This was unsafe/undefined behavior from the start, and RepeatCommand "
|
||||
"provides an easy way to achieve similar end results with slightly "
|
||||
"different (and safe) semantics.")
|
||||
"different (and safe) semantics.")]]
|
||||
PerpetualCommand Perpetually() &&;
|
||||
|
||||
/**
|
||||
@@ -373,7 +371,7 @@ safe) semantics.
|
||||
*
|
||||
* @deprecated Moved to IsComposed()
|
||||
*/
|
||||
WPI_DEPRECATED("Moved to IsComposed()")
|
||||
[[deprecated("Moved to IsComposed()")]]
|
||||
bool IsGrouped() const;
|
||||
|
||||
/**
|
||||
@@ -383,7 +381,7 @@ safe) semantics.
|
||||
*
|
||||
* @deprecated Moved to SetComposed()
|
||||
*/
|
||||
WPI_DEPRECATED("Moved to SetComposed()")
|
||||
[[deprecated("Moved to SetComposed()")]]
|
||||
void SetGrouped(bool grouped);
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
|
||||
namespace frc2 {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <units/time.h>
|
||||
#include <wpi/FunctionExtras.h>
|
||||
#include <wpi/concepts.h>
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/sendable/SendableHelper.h>
|
||||
|
||||
namespace frc2 {
|
||||
@@ -81,7 +80,7 @@ class CommandScheduler final : public nt::NTSendable,
|
||||
/**
|
||||
* Removes all button bindings from the scheduler.
|
||||
*/
|
||||
WPI_DEPRECATED("Call Clear on the EventLoop instance directly!")
|
||||
[[deprecated("Call Clear on the EventLoop instance directly!")]]
|
||||
void ClearButtons();
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <wpi/concepts.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
#include "frc2/command/CommandHelper.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/concepts.h>
|
||||
#include <wpi/deprecated.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
|
||||
@@ -41,8 +41,7 @@ class Button : public Trigger {
|
||||
* can be further determined by subclass code.
|
||||
* @deprecated Replace with Trigger
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger")
|
||||
Button() = default;
|
||||
[[deprecated("Replace with Trigger")]] Button() = default;
|
||||
|
||||
/**
|
||||
* Binds a command to start when the button is pressed. Takes a
|
||||
@@ -53,7 +52,7 @@ class Button : public Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Replace with Trigger::OnTrue()
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnTrue()")
|
||||
[[deprecated("Replace with Trigger#OnTrue()")]]
|
||||
Button WhenPressed(Command* command);
|
||||
|
||||
/**
|
||||
@@ -67,7 +66,7 @@ class Button : public Trigger {
|
||||
* @deprecated Replace with Trigger::OnTrue()
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Replace with Trigger#OnTrue()")
|
||||
[[deprecated("Replace with Trigger#OnTrue()")]]
|
||||
Button WhenPressed(T&& command) {
|
||||
WhenActive(std::forward<T>(command));
|
||||
return *this;
|
||||
@@ -80,7 +79,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::OnTrue(cmd::RunOnce())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnTrue(cmd::RunOnce())")
|
||||
[[deprecated("Replace with Trigger#OnTrue(cmd::RunOnce())")]]
|
||||
Button WhenPressed(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -91,7 +90,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::OnTrue(cmd::RunOnce())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnTrue(cmd::RunOnce())")
|
||||
[[deprecated("Replace with Trigger#OnTrue(cmd::RunOnce())")]]
|
||||
Button WhenPressed(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -104,7 +103,7 @@ class Button : public Trigger {
|
||||
* @return The button, for chained calls.
|
||||
* @deprecated Replace with Trigger::WhileTrue(command.Repeatedly())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue(command.Repeatedly())")
|
||||
[[deprecated("Replace with Trigger#WhileTrue(command.Repeatedly())")]]
|
||||
Button WhileHeld(Command* command);
|
||||
|
||||
/**
|
||||
@@ -118,7 +117,7 @@ class Button : public Trigger {
|
||||
* @deprecated Replace with Trigger::WhileTrue(command.Repeatedly())
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue(command.Repeatedly())")
|
||||
[[deprecated("Replace with Trigger#WhileTrue(command.Repeatedly())")]]
|
||||
Button WhileHeld(T&& command) {
|
||||
WhileActiveContinous(std::forward<T>(command));
|
||||
return *this;
|
||||
@@ -131,7 +130,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::WhileTrue(cmd::Run())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue(cmd::Run())")
|
||||
[[deprecated("Replace with Trigger#WhileTrue(cmd::Run())")]]
|
||||
Button WhileHeld(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -142,7 +141,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::WhileTrue(cmd::Run())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue(cmd::Run())")
|
||||
[[deprecated("Replace with Trigger#WhileTrue(cmd::Run())")]]
|
||||
Button WhileHeld(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -155,7 +154,7 @@ class Button : public Trigger {
|
||||
* @return The button, for chained calls.
|
||||
* @deprecated Replace with Trigger::WhileTrue()
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue()")
|
||||
[[deprecated("Replace with Trigger#WhileTrue()")]]
|
||||
Button WhenHeld(Command* command);
|
||||
|
||||
/**
|
||||
@@ -169,7 +168,7 @@ class Button : public Trigger {
|
||||
* @deprecated Replace with Trigger::WhileTrue()
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Replace with Trigger#WhileTrue()")
|
||||
[[deprecated("Replace with Trigger#WhileTrue()")]]
|
||||
Button WhenHeld(T&& command) {
|
||||
WhileActiveOnce(std::forward<T>(command));
|
||||
return *this;
|
||||
@@ -184,7 +183,7 @@ class Button : public Trigger {
|
||||
* @return The button, for chained calls.
|
||||
* @deprecated Replace with Trigger::OnFalse()
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnFalse()")
|
||||
[[deprecated("Replace with Trigger#OnFalse()")]]
|
||||
Button WhenReleased(Command* command);
|
||||
|
||||
/**
|
||||
@@ -198,7 +197,7 @@ class Button : public Trigger {
|
||||
* @deprecated Replace with Trigger::OnFalse()
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Replace with Trigger#OnFalse()")
|
||||
[[deprecated("Replace with Trigger#OnFalse()")]]
|
||||
Button WhenReleased(T&& command) {
|
||||
WhenInactive(std::forward<T>(command));
|
||||
return *this;
|
||||
@@ -211,7 +210,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::OnFalse(cmd::RunOnce())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnFalse(cmd::RunOnce())")
|
||||
[[deprecated("Replace with Trigger#OnFalse(cmd::RunOnce())")]]
|
||||
Button WhenReleased(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -222,7 +221,7 @@ class Button : public Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Replace with Trigger::OnFalse(cmd::RunOnce())
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#OnFalse(cmd::RunOnce())")
|
||||
[[deprecated("Replace with Trigger#OnFalse(cmd::RunOnce())")]]
|
||||
Button WhenReleased(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -235,7 +234,7 @@ class Button : public Trigger {
|
||||
* @return The button, for chained calls.
|
||||
* @deprecated Replace with Trigger::ToggleOnTrue()
|
||||
*/
|
||||
WPI_DEPRECATED("Replace with Trigger#ToggleOnTrue()")
|
||||
[[deprecated("Replace with Trigger#ToggleOnTrue()")]]
|
||||
Button ToggleWhenPressed(Command* command);
|
||||
|
||||
/**
|
||||
@@ -249,7 +248,7 @@ class Button : public Trigger {
|
||||
* @deprecated Replace with Trigger::ToggleOnTrue()
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Replace with Trigger#ToggleOnTrue()")
|
||||
[[deprecated("Replace with Trigger#ToggleOnTrue()")]]
|
||||
Button ToggleWhenPressed(T&& command) {
|
||||
ToggleWhenActive(std::forward<T>(command));
|
||||
return *this;
|
||||
@@ -264,7 +263,7 @@ class Button : public Trigger {
|
||||
* @return The button, for chained calls.
|
||||
* @deprecated Pass this as a command end condition with Until() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Pass this as a command end condition with Until() instead.")
|
||||
[[deprecated("Pass this as a command end condition with Until() instead.")]]
|
||||
Button CancelWhenPressed(Command* command);
|
||||
};
|
||||
} // namespace frc2
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/GenericHID.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <frc/filter/Debouncer.h>
|
||||
#include <units/time.h>
|
||||
#include <wpi/concepts.h>
|
||||
#include <wpi/deprecated.h>
|
||||
|
||||
#include "frc2/command/Command.h"
|
||||
#include "frc2/command/CommandScheduler.h"
|
||||
@@ -214,7 +213,7 @@ class Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Use OnTrue(Command) instead
|
||||
*/
|
||||
WPI_DEPRECATED("Use OnTrue(Command) instead")
|
||||
[[deprecated("Use OnTrue(Command) instead")]]
|
||||
Trigger WhenActive(Command* command);
|
||||
|
||||
/**
|
||||
@@ -228,7 +227,7 @@ class Trigger {
|
||||
* @deprecated Use OnTrue(Command) instead
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Use OnTrue(Command) instead")
|
||||
[[deprecated("Use OnTrue(Command) instead")]]
|
||||
Trigger WhenActive(T&& command) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
command = std::make_unique<std::decay_t<T>>(
|
||||
@@ -252,8 +251,8 @@ class Trigger {
|
||||
* @deprecated Use OnTrue(Command) instead and construct the InstantCommand
|
||||
* manually
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
"Use OnTrue(Command) instead and construct the InstantCommand manually")
|
||||
[[deprecated(
|
||||
"Use OnTrue(Command) instead and construct the InstantCommand manually")]]
|
||||
Trigger WhenActive(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -265,8 +264,8 @@ class Trigger {
|
||||
* @deprecated Use OnTrue(Command) instead and construct the InstantCommand
|
||||
* manually
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
"Use OnTrue(Command) instead and construct the InstantCommand manually")
|
||||
[[deprecated(
|
||||
"Use OnTrue(Command) instead and construct the InstantCommand manually")]]
|
||||
Trigger WhenActive(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -280,9 +279,9 @@ class Trigger {
|
||||
* @deprecated Use WhileTrue(Command) with RepeatCommand, or bind
|
||||
command::Schedule with IfHigh(std::function<void()>).
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
[[deprecated(
|
||||
"Use WhileTrue(Command) with RepeatCommand, or bind command::Schedule "
|
||||
"with IfHigh(std::function<void()>).")
|
||||
"with IfHigh(std::function<void()>).")]]
|
||||
Trigger WhileActiveContinous(Command* command);
|
||||
|
||||
/**
|
||||
@@ -297,9 +296,9 @@ class Trigger {
|
||||
command::Schedule with IfHigh(std::function<void()>).
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED(
|
||||
[[deprecated(
|
||||
"Use WhileTrue(Command) with RepeatCommand, or bind command::Schedule "
|
||||
"with IfHigh(std::function<void()>).")
|
||||
"with IfHigh(std::function<void()>).")]]
|
||||
Trigger WhileActiveContinous(T&& command) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
command = std::make_unique<std::decay_t<T>>(
|
||||
@@ -325,7 +324,7 @@ class Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Use WhileTrue(Command) and construct a RunCommand manually
|
||||
*/
|
||||
WPI_DEPRECATED("Use WhileTrue(Command) and construct a RunCommand manually")
|
||||
[[deprecated("Use WhileTrue(Command) and construct a RunCommand manually")]]
|
||||
Trigger WhileActiveContinous(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -336,7 +335,7 @@ class Trigger {
|
||||
* @param requirements the required subsystems.
|
||||
* @deprecated Use WhileTrue(Command) and construct a RunCommand manually
|
||||
*/
|
||||
WPI_DEPRECATED("Use WhileTrue(Command) and construct a RunCommand manually")
|
||||
[[deprecated("Use WhileTrue(Command) and construct a RunCommand manually")]]
|
||||
Trigger WhileActiveContinous(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -349,7 +348,7 @@ class Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Use WhileTrue(Command) instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use WhileTrue(Command) instead.")
|
||||
[[deprecated("Use WhileTrue(Command) instead.")]]
|
||||
Trigger WhileActiveOnce(Command* command);
|
||||
|
||||
/**
|
||||
@@ -363,7 +362,7 @@ class Trigger {
|
||||
* @deprecated Use WhileTrue(Command) instead.
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Use WhileTrue(Command) instead.")
|
||||
[[deprecated("Use WhileTrue(Command) instead.")]]
|
||||
Trigger WhileActiveOnce(T&& command) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
command = std::make_unique<std::decay_t<T>>(
|
||||
@@ -390,7 +389,7 @@ class Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Use OnFalse(Command) instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use OnFalse(Command) instead.")
|
||||
[[deprecated("Use OnFalse(Command) instead.")]]
|
||||
Trigger WhenInactive(Command* command);
|
||||
|
||||
/**
|
||||
@@ -404,7 +403,7 @@ class Trigger {
|
||||
* @deprecated Use OnFalse(Command) instead.
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Use OnFalse(Command) instead.")
|
||||
[[deprecated("Use OnFalse(Command) instead.")]]
|
||||
Trigger WhenInactive(T&& command) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
command = std::make_unique<std::decay_t<T>>(
|
||||
@@ -428,8 +427,9 @@ class Trigger {
|
||||
* @deprecated Use OnFalse(Command) instead and construct the InstantCommand
|
||||
* manually
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
"Use OnFalse(Command) instead and construct the InstantCommand manually")
|
||||
[[deprecated(
|
||||
"Use OnFalse(Command) instead and construct the InstantCommand "
|
||||
"manually")]]
|
||||
Trigger WhenInactive(std::function<void()> toRun,
|
||||
std::initializer_list<Subsystem*> requirements);
|
||||
|
||||
@@ -441,8 +441,9 @@ class Trigger {
|
||||
* @deprecated Use OnFalse(Command) instead and construct the InstantCommand
|
||||
* manually
|
||||
*/
|
||||
WPI_DEPRECATED(
|
||||
"Use OnFalse(Command) instead and construct the InstantCommand manually")
|
||||
[[deprecated(
|
||||
"Use OnFalse(Command) instead and construct the InstantCommand "
|
||||
"manually")]]
|
||||
Trigger WhenInactive(std::function<void()> toRun,
|
||||
std::span<Subsystem* const> requirements = {});
|
||||
|
||||
@@ -455,7 +456,7 @@ class Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Use ToggleOnTrue(Command) instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Use ToggleOnTrue(Command) instead.")
|
||||
[[deprecated("Use ToggleOnTrue(Command) instead.")]]
|
||||
Trigger ToggleWhenActive(Command* command);
|
||||
|
||||
/**
|
||||
@@ -469,7 +470,7 @@ class Trigger {
|
||||
* @deprecated Use ToggleOnTrue(Command) instead.
|
||||
*/
|
||||
template <std::derived_from<Command> T>
|
||||
WPI_DEPRECATED("Use ToggleOnTrue(Command) instead.")
|
||||
[[deprecated("Use ToggleOnTrue(Command) instead.")]]
|
||||
Trigger ToggleWhenActive(T&& command) {
|
||||
m_loop->Bind([condition = m_condition, previous = m_condition(),
|
||||
command = std::make_unique<std::decay_t<T>>(
|
||||
@@ -499,7 +500,7 @@ class Trigger {
|
||||
* @return The trigger, for chained calls.
|
||||
* @deprecated Pass this as a command end condition with Until() instead.
|
||||
*/
|
||||
WPI_DEPRECATED("Pass this as a command end condition with Until() instead.")
|
||||
[[deprecated("Pass this as a command end condition with Until() instead.")]]
|
||||
Trigger CancelWhenActive(Command* command);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user