Debian Codegraph @

src/libsysprof-capture/sysprof-version-macros.h

raw
1 /* sysprof-version-macros.h
2 *
3 * Copyright 2016-2019 Christian Hergert <[email protected]>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Subject to the terms and conditions of this license, each copyright holder
17 * and contributor hereby grants to those receiving rights under this license
18 * a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
19 * irrevocable (except for failure to satisfy the conditions of this license)
20 * patent license to make, have made, use, offer to sell, sell, import, and
21 * otherwise transfer this software, where such license applies only to those
22 * patent claims, already acquired or hereafter acquired, licensable by such
23 * copyright holder or contributor that are necessarily infringed by:
24 *
25 * (a) their Contribution(s) (the licensed copyrights of copyright holders
26 * and non-copyrightable additions of contributors, in source or binary
27 * form) alone; or
28 *
29 * (b) combination of their Contribution(s) with the work of authorship to
30 * which such Contribution(s) was added by such copyright holder or
31 * contributor, if, at the time the Contribution is added, such addition
32 * causes such combination to be necessarily infringed. The patent license
33 * shall not apply to any other combinations which include the
34 * Contribution.
35 *
36 * Except as expressly stated above, no rights or licenses from any copyright
37 * holder or contributor is granted under this license, whether expressly, by
38 * implication, estoppel or otherwise.
39 *
40 * DISCLAIMER
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
43 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
44 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
46 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
47 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
48 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
49 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
50 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
51 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
52 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 *
54 * SPDX-License-Identifier: BSD-2-Clause-Patent
55 */
56
57 #pragma once
58
59 #include "sysprof-version.h"
60
61 #ifndef _SYSPROF_EXTERN
62 #define _SYSPROF_EXTERN extern
63 #endif
64
65 #if defined(__GNUC__) || defined (__clang__)
66 #define _SYSPROF_DEPRECATED __attribute__((__deprecated__))
67 #define _SYSPROF_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
68 #define _SYSPROF_UNAVAILABLE(maj,min) __attribute__((__deprecated__("Not available before " #maj "." #min)))
69 #elif defined(_MSC_VER)
70 #define _SYSPROF_DEPRECATED __declspec(deprecated)
71 #define _SYSPROF_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
72 #define _SYSPROF_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min))
73 #else
74 #define _SYSPROF_DEPRECATED
75 #define _SYSPROF_DEPRECATED_FOR(f)
76 #define _SYSPROF_UNAVAILABLE(maj,min)
77 #endif
78
79 #ifdef SYSPROF_DISABLE_DEPRECATION_WARNINGS
80 #define SYSPROF_DEPRECATED _SYSPROF_EXTERN
81 #define SYSPROF_DEPRECATED_FOR(f) _SYSPROF_EXTERN
82 #define SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
83 #else
84 #define SYSPROF_DEPRECATED _SYSPROF_DEPRECATED _SYSPROF_EXTERN
85 #define SYSPROF_DEPRECATED_FOR(f) _SYSPROF_DEPRECATED_FOR(f) _SYSPROF_EXTERN
86 #define SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
87 #endif
88
89 #define SYSPROF_VERSION_3_34 (SYSPROF_ENCODE_VERSION (3, 34, 0))
90 #define SYSPROF_VERSION_3_36 (SYSPROF_ENCODE_VERSION (3, 36, 0))
91 #define SYSPROF_VERSION_3_38 (SYSPROF_ENCODE_VERSION (3, 38, 0))
92 #define SYSPROF_VERSION_3_40 (SYSPROF_ENCODE_VERSION (3, 40, 0))
93 #define SYSPROF_VERSION_3_46 (SYSPROF_ENCODE_VERSION (3, 46, 0))
94 #define SYSPROF_VERSION_48 (SYSPROF_ENCODE_VERSION (48, 0, 0))
95 #define SYSPROF_VERSION_49 (SYSPROF_ENCODE_VERSION (49, 0, 0))
96 #define SYSPROF_VERSION_50 (SYSPROF_ENCODE_VERSION (50, 0, 0))
97
98 #if (SYSPROF_MINOR_VERSION == 99)
99 # define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0, 0))
100 #elif (SYSPROF_MINOR_VERSION % 2)
101 # define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION + 1, 0))
102 #else
103 # define SYSPROF_VERSION_CUR_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION, 0))
104 #endif
105
106 #if (SYSPROF_MINOR_VERSION == 99)
107 # define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0, 0))
108 #elif (SYSPROF_MINOR_VERSION % 2)
109 # define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 1, 0))
110 #else
111 # define SYSPROF_VERSION_PREV_STABLE (SYSPROF_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 2, 0))
112 #endif
113
114 /**
115 * SYSPROF_VERSION_MIN_REQUIRED:
116 *
117 * A macro that should be defined by the user prior to including
118 * the ide.h header.
119 *
120 * The definition should be one of the predefined IDE version
121 * macros: %SYSPROF_VERSION_3_34, ...
122 *
123 * This macro defines the lower bound for the Builder API to use.
124 *
125 * If a function has been deprecated in a newer version of Builder,
126 * it is possible to use this symbol to avoid the compiler warnings
127 * without disabling warning for every deprecated function.
128 *
129 * Since: 3.34
130 */
131 #ifndef SYSPROF_VERSION_MIN_REQUIRED
132 # define SYSPROF_VERSION_MIN_REQUIRED (SYSPROF_VERSION_CUR_STABLE)
133 #endif
134
135 /**
136 * SYSPROF_VERSION_MAX_ALLOWED:
137 *
138 * A macro that should be defined by the user prior to including
139 * the ide.h header.
140
141 * The definition should be one of the predefined Builder version
142 * macros: %SYSPROF_VERSION_1_0, %SYSPROF_VERSION_1_2,...
143 *
144 * This macro defines the upper bound for the IDE API to use.
145 *
146 * If a function has been introduced in a newer version of Builder,
147 * it is possible to use this symbol to get compiler warnings when
148 * trying to use that function.
149 *
150 * Since: 3.34
151 */
152 #ifndef SYSPROF_VERSION_MAX_ALLOWED
153 # if SYSPROF_VERSION_MIN_REQUIRED > SYSPROF_VERSION_PREV_STABLE
154 # define SYSPROF_VERSION_MAX_ALLOWED (SYSPROF_VERSION_MIN_REQUIRED)
155 # else
156 # define SYSPROF_VERSION_MAX_ALLOWED (SYSPROF_VERSION_CUR_STABLE)
157 # endif
158 #endif
159
160 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_MIN_REQUIRED
161 #error "SYSPROF_VERSION_MAX_ALLOWED must be >= SYSPROF_VERSION_MIN_REQUIRED"
162 #endif
163 #if SYSPROF_VERSION_MIN_REQUIRED < SYSPROF_VERSION_3_34
164 #error "SYSPROF_VERSION_MIN_REQUIRED must be >= SYSPROF_VERSION_3_34"
165 #endif
166
167 #define SYSPROF_AVAILABLE_IN_ALL _SYSPROF_EXTERN
168
169 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_34
170 # define SYSPROF_DEPRECATED_IN_3_34 SYSPROF_DEPRECATED
171 # define SYSPROF_DEPRECATED_IN_3_34_FOR(f) SYSPROF_DEPRECATED_FOR(f)
172 #else
173 # define SYSPROF_DEPRECATED_IN_3_34 _SYSPROF_EXTERN
174 # define SYSPROF_DEPRECATED_IN_3_34_FOR(f) _SYSPROF_EXTERN
175 #endif
176
177 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_34
178 # define SYSPROF_AVAILABLE_IN_3_34 SYSPROF_UNAVAILABLE(3, 34)
179 #else
180 # define SYSPROF_AVAILABLE_IN_3_34 _SYSPROF_EXTERN
181 #endif
182
183 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_36
184 # define SYSPROF_DEPRECATED_IN_3_36 SYSPROF_DEPRECATED
185 # define SYSPROF_DEPRECATED_IN_3_36_FOR(f) SYSPROF_DEPRECATED_FOR(f)
186 #else
187 # define SYSPROF_DEPRECATED_IN_3_36 _SYSPROF_EXTERN
188 # define SYSPROF_DEPRECATED_IN_3_36_FOR(f) _SYSPROF_EXTERN
189 #endif
190
191 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_36
192 # define SYSPROF_AVAILABLE_IN_3_36 SYSPROF_UNAVAILABLE(3, 36)
193 #else
194 # define SYSPROF_AVAILABLE_IN_3_36 _SYSPROF_EXTERN
195 #endif
196
197 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_38
198 # define SYSPROF_DEPRECATED_IN_3_38 SYSPROF_DEPRECATED
199 # define SYSPROF_DEPRECATED_IN_3_38_FOR(f) SYSPROF_DEPRECATED_FOR(f)
200 #else
201 # define SYSPROF_DEPRECATED_IN_3_38 _SYSPROF_EXTERN
202 # define SYSPROF_DEPRECATED_IN_3_38_FOR(f) _SYSPROF_EXTERN
203 #endif
204
205 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_38
206 # define SYSPROF_AVAILABLE_IN_3_38 SYSPROF_UNAVAILABLE(3, 38)
207 #else
208 # define SYSPROF_AVAILABLE_IN_3_38 _SYSPROF_EXTERN
209 #endif
210
211 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_40
212 # define SYSPROF_DEPRECATED_IN_3_40 SYSPROF_DEPRECATED
213 # define SYSPROF_DEPRECATED_IN_3_40_FOR(f) SYSPROF_DEPRECATED_FOR(f)
214 #else
215 # define SYSPROF_DEPRECATED_IN_3_40 _SYSPROF_EXTERN
216 # define SYSPROF_DEPRECATED_IN_3_40_FOR(f) _SYSPROF_EXTERN
217 #endif
218
219 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_40
220 # define SYSPROF_AVAILABLE_IN_3_40 SYSPROF_UNAVAILABLE(3, 40)
221 #else
222 # define SYSPROF_AVAILABLE_IN_3_40 _SYSPROF_EXTERN
223 #endif
224
225 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_46
226 # define SYSPROF_DEPRECATED_IN_3_46 SYSPROF_DEPRECATED
227 # define SYSPROF_DEPRECATED_IN_3_46_FOR(f) SYSPROF_DEPRECATED_FOR(f)
228 #else
229 # define SYSPROF_DEPRECATED_IN_3_46 _SYSPROF_EXTERN
230 # define SYSPROF_DEPRECATED_IN_3_46_FOR(f) _SYSPROF_EXTERN
231 #endif
232
233 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_46
234 # define SYSPROF_AVAILABLE_IN_3_46 SYSPROF_UNAVAILABLE(3, 46)
235 #else
236 # define SYSPROF_AVAILABLE_IN_3_46 _SYSPROF_EXTERN
237 #endif
238
239 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_48
240 # define SYSPROF_DEPRECATED_IN_48 SYSPROF_DEPRECATED
241 # define SYSPROF_DEPRECATED_IN_48_FOR(f) SYSPROF_DEPRECATED_FOR(f)
242 #else
243 # define SYSPROF_DEPRECATED_IN_48 _SYSPROF_EXTERN
244 # define SYSPROF_DEPRECATED_IN_48_FOR(f) _SYSPROF_EXTERN
245 #endif
246
247 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_48
248 # define SYSPROF_AVAILABLE_IN_48 SYSPROF_UNAVAILABLE(48, 0)
249 #else
250 # define SYSPROF_AVAILABLE_IN_48 _SYSPROF_EXTERN
251 #endif
252
253 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_49
254 # define SYSPROF_DEPRECATED_IN_49 SYSPROF_DEPRECATED
255 # define SYSPROF_DEPRECATED_IN_49_FOR(f) SYSPROF_DEPRECATED_FOR(f)
256 #else
257 # define SYSPROF_DEPRECATED_IN_49 _SYSPROF_EXTERN
258 # define SYSPROF_DEPRECATED_IN_49_FOR(f) _SYSPROF_EXTERN
259 #endif
260
261 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_49
262 # define SYSPROF_AVAILABLE_IN_49 SYSPROF_UNAVAILABLE(49, 0)
263 #else
264 # define SYSPROF_AVAILABLE_IN_49 _SYSPROF_EXTERN
265 #endif
266
267 #if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_50
268 # define SYSPROF_DEPRECATED_IN_50 SYSPROF_DEPRECATED
269 # define SYSPROF_DEPRECATED_IN_50_FOR(f) SYSPROF_DEPRECATED_FOR(f)
270 #else
271 # define SYSPROF_DEPRECATED_IN_50 _SYSPROF_EXTERN
272 # define SYSPROF_DEPRECATED_IN_50_FOR(f) _SYSPROF_EXTERN
273 #endif
274
275 #if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_50
276 # define SYSPROF_AVAILABLE_IN_50 SYSPROF_UNAVAILABLE(50, 0)
277 #else
278 # define SYSPROF_AVAILABLE_IN_50 _SYSPROF_EXTERN
279 #endif