9 #ifndef IMPBASE_DEPRECATION_MACROS_H
10 #define IMPBASE_DEPRECATION_MACROS_H
12 #include <IMP/base/base_config.h>
17 #define IMP_DEPRECATED_MACRO(version, help_message) \
18 IMP_PRAGMA(message("This macro is deprecated as of IMP " #version \
23 #define IMP_DEPRECATED_OBJECT_RUNTIME_WARNING(version, help_message) \
25 std::ostringstream oss; \
26 oss << "Object " << get_module_name() << "::" << get_type_name() \
27 << " is deprecated. " << help_message << std::endl; \
28 IMP::base::handle_use_deprecated(oss.str()); \
33 #define IMP_DEPRECATED_VALUE_RUNTIME_WARNING(version, help_message) \
35 std::ostringstream oss; \
36 oss << "Class " << get_module_name() << "::" << IMP_CURRENT_FUNCTION \
37 << " is deprecated. " << help_message << std::endl; \
38 IMP::base::handle_use_deprecated(oss.str()); \
43 #define IMP_DEPRECATED_FUNCTION_RUNTIME_WARNING(version, help_message) \
45 std::ostringstream oss; \
46 oss << "Function " << IMP_CURRENT_PRETTY_FUNCTION << " is deprecated. " \
47 << help_message << std::endl; \
48 IMP::base::handle_use_deprecated(oss.str()); \
53 #define IMP_DEPRECATED_METHOD_RUNTIME_WARNING(version, help_message) \
55 std::ostringstream oss; \
56 oss << "Method " << IMP_CURRENT_PRETTY_FUNCTION << " is deprecated. " \
57 << "WARNING: " << help_message << std::endl; \
58 IMP::base::handle_use_deprecated(oss.str()); \
64 #define IMP_DEPRECATED_OBJECT(replacement_classname) \
65 IMP_DEPRECATED_MACRO( \
67 "Use IMP@MODULE@_DEPRECATED_OBJECT_DECL()") \
68 if (::IMP::base::internal:: \
69 get_print_deprecation_message( \
71 IMP_WARN(get_name() << " is deprecated " \
72 << "and should not be used.\nUse " \
73 << #replacement_classname << " instead." \
75 ::IMP::base::internal::set_printed_deprecation_message(get_name(), true); \
80 #define IMP_DEPRECATED_CLASS(classname, replacement_classname) \
81 IMP_DEPRECATED_MACRO( \
83 "Use IMP@MODULE@_DEPRECATED_VALUE_DEF " \
84 "instead") if (::IMP::base::internal:: \
85 get_print_deprecation_message(#classname)) { \
86 IMP_WARN(#classname << " is deprecated " \
87 << "and should not be used.\nUse " \
88 << #replacement_classname << " instead." \
90 ::IMP::base::internal::set_printed_deprecation_message(#classname, true); \
95 #define IMP_DEPRECATED_FUNCTION(replacement) \
96 IMP_DEPRECATED_MACRO( \
97 2.1, "Use IMP@MODULE@_DEPRECATED_FUNCTION_DECL/DEF instead"); \
98 if (::IMP::base::internal::get_print_deprecation_message( \
99 IMP_CURRENT_FUNCTION)) { \
100 IMP_WARN(IMP_CURRENT_FUNCTION << " is deprecated " \
101 << "and should not be used.\nUse " \
102 << #replacement << " instead." \
104 ::IMP::base::internal::set_printed_deprecation_message( \
105 IMP_CURRENT_FUNCTION, true); \
108 #if !defined(IMP_SWIG_WRAPPER) && (defined(__GNUC__) || defined(__clang__))
109 #define IMP_DEPRECATED_WARN \
110 IMP_DEPRECATED_MACRO(2.1, "Use IMPMODULE_DEPRECATED_FUNCTION_DEF") \
111 __attribute__((deprecated))
118 #define IMP_DEPRECATED_WARN
121 #define IMP_DEPRECATED_FUNCTION_DEF(version, message)
Control display of deprecation information.