Provide DEPRECATED macro as portable version of [[deprecated]].

The [[deprecated]] attribute is a C++14 feature not supported by MSVC or
GCC < 4.9, but can be simulated on both of these compilers through the
use of alternative (compiler-specific) attribute methods.

Change-Id: I34aed5705db2407c592f7cabd5274358c48d34fe
This commit is contained in:
Peter Johnson
2015-09-23 23:44:54 -07:00
committed by Brad Miller (WPI)
parent ef3fa53fc3
commit f64b055499
17 changed files with 92 additions and 92 deletions

View File

@@ -46,10 +46,10 @@ Counter::Counter(Mode mode) {
* @param source A pointer to the existing DigitalSource object. It will be set
* as the Up Source.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; if you just want to construct a Counter with "
"its own DigitalSource, then call the Counter(int channel). If you want to "
"keep your own copy of the DigitalSource, use std::shared_ptr.")]]
"keep your own copy of the DigitalSource, use std::shared_ptr.")
Counter::Counter(DigitalSource *source) : Counter() {
SetUpSource(source);
ClearDownSource();
@@ -93,8 +93,8 @@ Counter::Counter(int32_t channel) : Counter() {
* The counter will start counting immediately.
* @param trigger The pointer to the existing AnalogTrigger object.
*/
[[deprecated(
"Raw pointers are deprecated. Use pass-by-reference instead.")]]
DEPRECATED(
"Raw pointers are deprecated. Use pass-by-reference instead.")
Counter::Counter(AnalogTrigger *trigger) : Counter() {
SetUpSource(trigger->CreateOutput(kState));
ClearDownSource();
@@ -121,8 +121,8 @@ Counter::Counter(const AnalogTrigger &trigger) : Counter() {
* @param downSource The pointer to the DigitalSource to set as the down source
* @param inverted True to invert the output (reverse the direction)
*/
[[deprecated(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")]]
DEPRECATED(
"Raw pointers are deprecated; prefer to use shared_ptr instead.")
Counter::Counter(EncodingType encodingType, DigitalSource *upSource,
DigitalSource *downSource, bool inverted)
: Counter(encodingType,
@@ -193,9 +193,9 @@ void Counter::SetUpSource(int32_t channel) {
* @param analogTrigger The analog trigger object that is used for the Up Source
* @param triggerType The analog trigger output that will trigger the counter.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")]]
"SetUpSource(shared_ptr).")
void Counter::SetUpSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetUpSource(std::shared_ptr<AnalogTrigger>(analogTrigger,
@@ -232,7 +232,7 @@ void Counter::SetUpSource(std::shared_ptr<DigitalSource> source) {
}
}
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void Counter::SetUpSource(DigitalSource *source) {
SetUpSource(
std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
@@ -243,7 +243,7 @@ void Counter::SetUpSource(DigitalSource *source) {
* Set the up counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the up source
*/
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void Counter::SetUpSource(DigitalSource &source) {
SetUpSource(
std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
@@ -294,9 +294,9 @@ void Counter::SetDownSource(int32_t channel) {
* Source
* @param triggerType The analog trigger output that will trigger the counter.
*/
[[deprecated(
DEPRECATED(
"Raw pointers are deprecated; prefer to call either SetUpSource(int) or "
"SetUpSource(shared_ptr).")]]
"SetUpSource(shared_ptr).")
void Counter::SetDownSource(AnalogTrigger *analogTrigger,
AnalogTriggerType triggerType) {
SetDownSource(std::shared_ptr<AnalogTrigger>(analogTrigger, NullDeleter<AnalogTrigger>()), triggerType);
@@ -332,7 +332,7 @@ void Counter::SetDownSource(std::shared_ptr<DigitalSource> source) {
}
}
[[deprecated("Raw pointers are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("Raw pointers are deprecated. Use std::shared_ptr instead.")
void Counter::SetDownSource(DigitalSource *source) {
SetDownSource(std::shared_ptr<DigitalSource>(source, NullDeleter<DigitalSource>()));
}
@@ -342,7 +342,7 @@ void Counter::SetDownSource(DigitalSource *source) {
* Set the down counting DigitalSource.
* @param source Reference to the DigitalSource object to set as the down source
*/
[[deprecated("References are deprecated. Use std::shared_ptr instead.")]]
DEPRECATED("References are deprecated. Use std::shared_ptr instead.")
void Counter::SetDownSource(DigitalSource &source) {
SetDownSource(std::shared_ptr<DigitalSource>(&source, NullDeleter<DigitalSource>()));
}