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:
Tyler Veness
2023-06-08 00:01:06 -07:00
committed by GitHub
parent 753cb49a5e
commit 59905ea721
17 changed files with 69 additions and 70 deletions

View File

@@ -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);
/**