From d1065f0bd10f42620fde5da9f504645a92ac72d4 Mon Sep 17 00:00:00 2001 From: Thad House Date: Thu, 3 Nov 2016 20:08:47 -0700 Subject: [PATCH] Moves deprecation definition to wpiutil (#149) --- include/support/deprecated.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/support/deprecated.h diff --git a/include/support/deprecated.h b/include/support/deprecated.h new file mode 100644 index 0000000000..4a22b7377d --- /dev/null +++ b/include/support/deprecated.h @@ -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_