crocoddyl  1.4.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
deprecate.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2020, University of Edinburgh
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
8 
9 #ifndef CROCODDYL_CORE_UTILS_DEPRECATE_HPP_
10 #define CROCODDYL_CORE_UTILS_DEPRECATE_HPP_
11 
12 // Helper to deprecate functions and methods
13 // See https://blog.samat.io/2017/02/27/Deprecating-functions-and-methods-in-Cplusplus/
14 // For C++14
15 #if __cplusplus >= 201402L
16 #if defined(__has_cpp_attribute)
17 #if __has_cpp_attribute(deprecated)
18 #define DEPRECATED(msg, func) [[deprecated(msg)]] func
19 #endif
20 #endif
21 // For everyone else
22 #else
23 #ifdef __GNUC__
24 #define DEPRECATED(msg, func) func __attribute__((deprecated(msg)))
25 #elif defined(_MSC_VER)
26 #define DEPRECATED(msg, func) __declspec(deprecated(msg)) func
27 #endif
28 #endif
29 
30 #endif // CROCODDYL_CORE_UTILS_DEPRECATE_HPP_