crocoddyl
1.6.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, CNRS, INRIA
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
// For more details, visit https://stackoverflow.com/questions/171435/portability-of-warning-preprocessor-directive
31
// (copy paste from pinocchio/macros.hpp)
32
#if defined(__GNUC__) || defined(__clang__)
33
#define CROCODDYL_PRAGMA(x) _Pragma(#x)
34
#define CROCODDYL_PRAGMA_MESSAGE(the_message) CROCODDYL_PRAGMA(GCC message #the_message)
35
#define CROCODDYL_PRAGMA_WARNING(the_message) CROCODDYL_PRAGMA(GCC warning #the_message)
36
#define CROCODDYL_PRAGMA_DEPRECATED(the_message) CROCODDYL_PRAGMA_WARNING(Deprecated : #the_message)
37
#define CROCODDYL_PRAGMA_DEPRECATED_HEADER(old_header, new_header) \
38
CROCODDYL_PRAGMA_WARNING( \
39
Deprecated header file \
40
: old_header has been replaced by new_header.\n Please use new_header instead of old_header.)
41
#endif
42
43
#endif // CROCODDYL_CORE_UTILS_DEPRECATE_HPP_
include
crocoddyl
core
utils
deprecate.hpp
Generated by
1.8.13