mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Moves deprecation definition to wpiutil (#149)
This commit is contained in:
committed by
Peter Johnson
parent
60d9f3de68
commit
cf0ec7b9a9
@@ -286,8 +286,9 @@ class NetworkTable : public ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetNumber(StringRef key, double defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetNumber(StringRef key, double defaultValue) instead")
|
||||
virtual double GetNumber(llvm::StringRef key) const override;
|
||||
|
||||
/**
|
||||
@@ -329,8 +330,9 @@ class NetworkTable : public ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetString(StringRef key, StringRef defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetString(StringRef key, StringRef defaultValue) instead")
|
||||
virtual std::string GetString(llvm::StringRef key) const override;
|
||||
|
||||
/**
|
||||
@@ -372,8 +374,9 @@ class NetworkTable : public ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetBoolean(StringRef key, bool defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetBoolean(StringRef key, bool defaultValue) instead")
|
||||
virtual bool GetBoolean(llvm::StringRef key) const override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,28 +12,7 @@
|
||||
|
||||
#include "llvm/StringRef.h"
|
||||
#include "nt_Value.h"
|
||||
|
||||
// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9.
|
||||
// We provide an equivalent warning implementation for those compilers here.
|
||||
#ifndef NT_DEPRECATED
|
||||
#if defined(_MSC_VER)
|
||||
#define NT_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#elif defined(__GNUC__)
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
|
||||
#if __cplusplus > 201103L
|
||||
#define NT_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#else
|
||||
#define NT_DEPRECATED(msg) [[gnu::deprecated(msg)]]
|
||||
#endif
|
||||
#else
|
||||
#define NT_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#endif
|
||||
#elif __cplusplus > 201103L
|
||||
#define NT_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#else
|
||||
#define NT_DEPRECATED(msg) /*nothing*/
|
||||
#endif
|
||||
#endif
|
||||
#include "support/deprecated.h"
|
||||
|
||||
class ITableListener;
|
||||
|
||||
@@ -190,8 +169,9 @@ class ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetNumber(StringRef key, double defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetNumber(StringRef key, double defaultValue) instead")
|
||||
virtual double GetNumber(llvm::StringRef key) const = 0;
|
||||
|
||||
/**
|
||||
@@ -232,8 +212,9 @@ class ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetString(StringRef key, StringRef defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetString(StringRef key, StringRef defaultValue) instead")
|
||||
virtual std::string GetString(llvm::StringRef key) const = 0;
|
||||
|
||||
/**
|
||||
@@ -278,8 +259,9 @@ class ITable {
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method.
|
||||
*/
|
||||
NT_DEPRECATED("Raises an exception if key not found; "
|
||||
"use GetBoolean(StringRef key, bool defaultValue) instead")
|
||||
WPI_DEPRECATED(
|
||||
"Raises an exception if key not found; "
|
||||
"use GetBoolean(StringRef key, bool defaultValue) instead")
|
||||
virtual bool GetBoolean(llvm::StringRef key) const = 0;
|
||||
|
||||
/**
|
||||
|
||||
33
wpiutil/include/support/deprecated.h
Normal file
33
wpiutil/include/support/deprecated.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2015. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DEPRECATED_H_
|
||||
#define DEPRECATED_H_
|
||||
|
||||
// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9.
|
||||
// We provide an equivalent warning implementation for those compilers here.
|
||||
#ifndef WPI_DEPRECATED
|
||||
#if defined(_MSC_VER)
|
||||
#define WPI_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#elif defined(__GNUC__)
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)
|
||||
#if __cplusplus > 201103L
|
||||
#define WPI_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#else
|
||||
#define WPI_DEPRECATED(msg) [[gnu::deprecated(msg)]]
|
||||
#endif
|
||||
#else
|
||||
#define WPI_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#endif
|
||||
#elif __cplusplus > 201103L
|
||||
#define WPI_DEPRECATED(msg) [[deprecated(msg)]]
|
||||
#else
|
||||
#define WPI_DEPRECATED(msg) /*nothing*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // DEPRECATED_H_
|
||||
Reference in New Issue
Block a user