vtkParaViewDeprecation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkParaViewDeprecation.h
5 
6 -------------------------------------------------------------------------
7  Copyright 2008 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9  the U.S. Government retains certain rights in this software.
10 -------------------------------------------------------------------------
11 
12  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13  All rights reserved.
14  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notice for more information.
19 
20 =========================================================================*/
21 
22 #ifndef vtkParaViewDeprecation_h
23 #define vtkParaViewDeprecation_h
24 
25 #include "vtkPVVersion.h"
26 
27 //----------------------------------------------------------------------------
28 // These macros may be used to deprecate APIs in ParaView. They act as
29 // attributes on method declarations and do not remove methods from a build
30 // based on build configuration.
31 //
32 // To use:
33 //
34 // In the declaration:
35 //
36 // ```cxx
37 // PARAVIEW_DEPRECATED_IN_5_10_0("reason for the deprecation")
38 // void oldApi();
39 // ```
40 //
41 // When selecting which version to deprecate an API in, use the newest macro
42 // available in this header.
43 //
44 // In the implementation:
45 //
46 // ```cxx
47 // // Hide PARAVIEW_DEPRECATED_IN_5_10_0() warnings for this class.
48 // #define PARAVIEW_DEPRECATION_LEVEL 0
49 //
50 // #include "vtkLegacy.h"
51 //
52 // void oldApi()
53 // {
54 // // One of:
55 // VTK_LEGACY_BODY(oldApi, "ParaView 5.10.0");
56 // VTK_LEGACY_REPLACED_BODY(oldApi, "ParaView 5.10.0", newApi);
57 //
58 // // Remaining implementation.
59 // }
60 // ```
61 //
62 // Please note the `PARAVIEW_DEPRECATED_IN_` version in the
63 // `PARAVIEW_DEPRECATION_LEVEL` comment so that it can be removed when that
64 // version is finally removed.
65 //----------------------------------------------------------------------------
66 
67 // The level at which warnings should be made.
68 #ifndef PARAVIEW_DEPRECATION_LEVEL
69 // ParaView defaults to deprecation of its current version.
70 #define PARAVIEW_DEPRECATION_LEVEL PARAVIEW_VERSION_NUMBER
71 #endif
72 
73 // API deprecated before 5.9.0 have already been removed.
74 #define PARAVIEW_MINIMUM_DEPRECATION_LEVEL PARAVIEW_VERSION_CHECK(5, 9, 0)
75 
76 // Force the deprecation level to be at least that of ParaView's build
77 // configuration.
78 #if PARAVIEW_DEPRECATION_LEVEL < PARAVIEW_MINIMUM_DEPRECATION_LEVEL
79 #undef PARAVIEW_DEPRECATION_LEVEL
80 #define PARAVIEW_DEPRECATION_LEVEL PARAVIEW_MINIMUM_DEPRECATION_LEVEL
81 #endif
82 
83 // Deprecation macro support for various compilers.
84 #if 0 && __cplusplus >= 201402L
85 // This is currently hard-disabled because compilers do not mix C++ attributes
86 // and `__attribute__` extensions together well.
87 #define PARAVIEW_DEPRECATION(reason) [[deprecated(reason)]]
88 #elif defined(VTK_WRAPPING_CXX)
89 // Ignore deprecation in wrapper code.
90 #define PARAVIEW_DEPRECATION(reason)
91 #elif defined(__VTK_WRAP__)
92 #define PARAVIEW_DEPRECATION(reason) [[vtk::deprecated(reason)]]
93 #else
94 #if defined(_WIN32) || defined(_WIN64)
95 #define PARAVIEW_DEPRECATION(reason) __declspec(deprecated(reason))
96 #elif defined(__clang__)
97 #if __has_extension(attribute_deprecated_with_message)
98 #define PARAVIEW_DEPRECATION(reason) __attribute__((__deprecated__(reason)))
99 #else
100 #define PARAVIEW_DEPRECATION(reason) __attribute__((__deprecated__))
101 #endif
102 #elif defined(__GNUC__)
103 #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5))
104 #define PARAVIEW_DEPRECATION(reason) __attribute__((__deprecated__(reason)))
105 #else
106 #define PARAVIEW_DEPRECATION(reason) __attribute__((__deprecated__))
107 #endif
108 #else
109 #define PARAVIEW_DEPRECATION(reason)
110 #endif
111 #endif
112 
113 // APIs deprecated in the next release.
114 #if defined(__VTK_WRAP__)
115 #define PARAVIEW_DEPRECATED_IN_5_11_0(reason) [[vtk::deprecated(reason, "5.11.0")]]
116 #elif PARAVIEW_DEPRECATION_LEVEL >= PARAVIEW_VERSION_CHECK(5, 11, 0)
117 #define PARAVIEW_DEPRECATED_IN_5_11_0(reason) PARAVIEW_DEPRECATION(reason)
118 #else
119 #define PARAVIEW_DEPRECATED_IN_5_11_0(reason)
120 #endif
121 
122 // APIs deprecated in 5.10.0.
123 #if defined(__VTK_WRAP__)
124 #define PARAVIEW_DEPRECATED_IN_5_10_0(reason) [[vtk::deprecated(reason, "5.10.0")]]
125 #elif PARAVIEW_DEPRECATION_LEVEL >= PARAVIEW_VERSION_CHECK(5, 10, 0)
126 #define PARAVIEW_DEPRECATED_IN_5_10_0(reason) PARAVIEW_DEPRECATION(reason)
127 #else
128 #define PARAVIEW_DEPRECATED_IN_5_10_0(reason)
129 #endif
130 
131 // APIs deprecated in the older release always warn.
132 #if defined(__VTK_WRAP__)
133 #define PARAVIEW_DEPRECATED_IN_5_9_0(reason) [[vtk::deprecated(reason, "5.9.0")]]
134 #else
135 #define PARAVIEW_DEPRECATED_IN_5_9_0(reason) PARAVIEW_DEPRECATION(reason)
136 #endif
137 
138 #endif
139 
140 // VTK-HeaderTest-Exclude: vtkParaViewDeprecation.h