gversionmacros.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*
  18. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  19. * file for a list of people on the GLib Team. See the ChangeLog
  20. * files for a list of changes. These files are distributed with
  21. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  22. */
  23. #ifndef __G_VERSION_MACROS_H__
  24. #define __G_VERSION_MACROS_H__
  25. #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  26. #error "Only <glib.h> can be included directly."
  27. #endif
  28. /* Version boundaries checks */
  29. #define G_ENCODE_VERSION(major,minor) ((major) << 16 | (minor) << 8)
  30. /* XXX: Every new stable minor release bump should add a macro here */
  31. /**
  32. * GLIB_VERSION_2_26:
  33. *
  34. * A macro that evaluates to the 2.26 version of GLib, in a format
  35. * that can be used by the C pre-processor.
  36. *
  37. * Since: 2.32
  38. */
  39. #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
  40. /**
  41. * GLIB_VERSION_2_28:
  42. *
  43. * A macro that evaluates to the 2.28 version of GLib, in a format
  44. * that can be used by the C pre-processor.
  45. *
  46. * Since: 2.32
  47. */
  48. #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
  49. /**
  50. * GLIB_VERSION_2_30:
  51. *
  52. * A macro that evaluates to the 2.30 version of GLib, in a format
  53. * that can be used by the C pre-processor.
  54. *
  55. * Since: 2.32
  56. */
  57. #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
  58. /**
  59. * GLIB_VERSION_2_32:
  60. *
  61. * A macro that evaluates to the 2.32 version of GLib, in a format
  62. * that can be used by the C pre-processor.
  63. *
  64. * Since: 2.32
  65. */
  66. #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
  67. /**
  68. * GLIB_VERSION_2_34:
  69. *
  70. * A macro that evaluates to the 2.34 version of GLib, in a format
  71. * that can be used by the C pre-processor.
  72. *
  73. * Since: 2.34
  74. */
  75. #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
  76. /**
  77. * GLIB_VERSION_2_36:
  78. *
  79. * A macro that evaluates to the 2.36 version of GLib, in a format
  80. * that can be used by the C pre-processor.
  81. *
  82. * Since: 2.36
  83. */
  84. #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
  85. /**
  86. * GLIB_VERSION_2_38:
  87. *
  88. * A macro that evaluates to the 2.38 version of GLib, in a format
  89. * that can be used by the C pre-processor.
  90. *
  91. * Since: 2.38
  92. */
  93. #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
  94. /**
  95. * GLIB_VERSION_2_40:
  96. *
  97. * A macro that evaluates to the 2.40 version of GLib, in a format
  98. * that can be used by the C pre-processor.
  99. *
  100. * Since: 2.40
  101. */
  102. #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
  103. /**
  104. * GLIB_VERSION_2_42:
  105. *
  106. * A macro that evaluates to the 2.42 version of GLib, in a format
  107. * that can be used by the C pre-processor.
  108. *
  109. * Since: 2.42
  110. */
  111. #define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42))
  112. /**
  113. * GLIB_VERSION_2_44:
  114. *
  115. * A macro that evaluates to the 2.44 version of GLib, in a format
  116. * that can be used by the C pre-processor.
  117. *
  118. * Since: 2.44
  119. */
  120. #define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44))
  121. /**
  122. * GLIB_VERSION_2_46:
  123. *
  124. * A macro that evaluates to the 2.46 version of GLib, in a format
  125. * that can be used by the C pre-processor.
  126. *
  127. * Since: 2.46
  128. */
  129. #define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46))
  130. /**
  131. * GLIB_VERSION_2_48:
  132. *
  133. * A macro that evaluates to the 2.48 version of GLib, in a format
  134. * that can be used by the C pre-processor.
  135. *
  136. * Since: 2.48
  137. */
  138. #define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48))
  139. /* evaluates to the current stable version; for development cycles,
  140. * this means the next stable target
  141. */
  142. #if (GLIB_MINOR_VERSION % 2)
  143. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
  144. #else
  145. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
  146. #endif
  147. /* evaluates to the previous stable version */
  148. #if (GLIB_MINOR_VERSION % 2)
  149. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
  150. #else
  151. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
  152. #endif
  153. /**
  154. * GLIB_VERSION_MIN_REQUIRED:
  155. *
  156. * A macro that should be defined by the user prior to including
  157. * the glib.h header.
  158. * The definition should be one of the predefined GLib version
  159. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  160. *
  161. * This macro defines the earliest version of GLib that the package is
  162. * required to be able to compile against.
  163. *
  164. * If the compiler is configured to warn about the use of deprecated
  165. * functions, then using functions that were deprecated in version
  166. * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
  167. * using functions deprecated in later releases will not).
  168. *
  169. * Since: 2.32
  170. */
  171. /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
  172. * GLIB_VERSION_X_Y value that we don't know about, it will compare as
  173. * 0 in preprocessor tests.
  174. */
  175. #ifndef GLIB_VERSION_MIN_REQUIRED
  176. # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
  177. #elif GLIB_VERSION_MIN_REQUIRED == 0
  178. # undef GLIB_VERSION_MIN_REQUIRED
  179. # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
  180. #endif
  181. /**
  182. * GLIB_VERSION_MAX_ALLOWED:
  183. *
  184. * A macro that should be defined by the user prior to including
  185. * the glib.h header.
  186. * The definition should be one of the predefined GLib version
  187. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  188. *
  189. * This macro defines the latest version of the GLib API that the
  190. * package is allowed to make use of.
  191. *
  192. * If the compiler is configured to warn about the use of deprecated
  193. * functions, then using functions added after version
  194. * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
  195. *
  196. * Unless you are using GLIB_CHECK_VERSION() or the like to compile
  197. * different code depending on the GLib version, then this should be
  198. * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
  199. *
  200. * Since: 2.32
  201. */
  202. #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
  203. # undef GLIB_VERSION_MAX_ALLOWED
  204. # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
  205. #endif
  206. /* sanity checks */
  207. #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
  208. #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
  209. #endif
  210. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
  211. #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
  212. #endif
  213. #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
  214. #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
  215. #endif
  216. /* These macros are used to mark deprecated functions in GLib headers,
  217. * and thus have to be exposed in installed headers. But please
  218. * do *not* use them in other projects. Instead, use G_DEPRECATED
  219. * or define your own wrappers around it.
  220. */
  221. #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
  222. /* XXX: Every new stable minor release should add a set of macros here */
  223. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
  224. # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
  225. # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
  226. #else
  227. # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
  228. # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
  229. #endif
  230. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
  231. # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
  232. #else
  233. # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
  234. #endif
  235. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
  236. # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
  237. # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
  238. #else
  239. # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
  240. # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
  241. #endif
  242. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
  243. # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
  244. #else
  245. # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
  246. #endif
  247. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
  248. # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
  249. # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
  250. #else
  251. # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
  252. # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
  253. #endif
  254. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
  255. # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
  256. #else
  257. # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
  258. #endif
  259. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
  260. # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
  261. # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
  262. #else
  263. # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
  264. # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
  265. #endif
  266. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
  267. # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
  268. #else
  269. # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
  270. #endif
  271. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
  272. # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
  273. # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
  274. #else
  275. # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
  276. # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
  277. #endif
  278. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
  279. # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
  280. #else
  281. # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
  282. #endif
  283. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
  284. # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
  285. # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
  286. #else
  287. # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
  288. # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
  289. #endif
  290. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
  291. # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
  292. #else
  293. # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
  294. #endif
  295. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
  296. # define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
  297. # define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
  298. #else
  299. # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
  300. # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
  301. #endif
  302. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
  303. # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
  304. #else
  305. # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
  306. #endif
  307. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
  308. # define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
  309. # define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
  310. #else
  311. # define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
  312. # define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
  313. #endif
  314. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
  315. # define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
  316. #else
  317. # define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
  318. #endif
  319. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42
  320. # define GLIB_DEPRECATED_IN_2_42 GLIB_DEPRECATED
  321. # define GLIB_DEPRECATED_IN_2_42_FOR(f) GLIB_DEPRECATED_FOR(f)
  322. #else
  323. # define GLIB_DEPRECATED_IN_2_42 _GLIB_EXTERN
  324. # define GLIB_DEPRECATED_IN_2_42_FOR(f) _GLIB_EXTERN
  325. #endif
  326. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42
  327. # define GLIB_AVAILABLE_IN_2_42 GLIB_UNAVAILABLE(2, 42)
  328. #else
  329. # define GLIB_AVAILABLE_IN_2_42 _GLIB_EXTERN
  330. #endif
  331. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
  332. # define GLIB_DEPRECATED_IN_2_44 GLIB_DEPRECATED
  333. # define GLIB_DEPRECATED_IN_2_44_FOR(f) GLIB_DEPRECATED_FOR(f)
  334. #else
  335. # define GLIB_DEPRECATED_IN_2_44 _GLIB_EXTERN
  336. # define GLIB_DEPRECATED_IN_2_44_FOR(f) _GLIB_EXTERN
  337. #endif
  338. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
  339. # define GLIB_AVAILABLE_IN_2_44 GLIB_UNAVAILABLE(2, 44)
  340. #else
  341. # define GLIB_AVAILABLE_IN_2_44 _GLIB_EXTERN
  342. #endif
  343. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46
  344. # define GLIB_DEPRECATED_IN_2_46 GLIB_DEPRECATED
  345. # define GLIB_DEPRECATED_IN_2_46_FOR(f) GLIB_DEPRECATED_FOR(f)
  346. #else
  347. # define GLIB_DEPRECATED_IN_2_46 _GLIB_EXTERN
  348. # define GLIB_DEPRECATED_IN_2_46_FOR(f) _GLIB_EXTERN
  349. #endif
  350. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46
  351. # define GLIB_AVAILABLE_IN_2_46 GLIB_UNAVAILABLE(2, 46)
  352. #else
  353. # define GLIB_AVAILABLE_IN_2_46 _GLIB_EXTERN
  354. #endif
  355. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48
  356. # define GLIB_DEPRECATED_IN_2_48 GLIB_DEPRECATED
  357. # define GLIB_DEPRECATED_IN_2_48_FOR(f) GLIB_DEPRECATED_FOR(f)
  358. #else
  359. # define GLIB_DEPRECATED_IN_2_48 _GLIB_EXTERN
  360. # define GLIB_DEPRECATED_IN_2_48_FOR(f) _GLIB_EXTERN
  361. #endif
  362. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48
  363. # define GLIB_AVAILABLE_IN_2_48 GLIB_UNAVAILABLE(2, 48)
  364. #else
  365. # define GLIB_AVAILABLE_IN_2_48 _GLIB_EXTERN
  366. #endif
  367. #endif /* __G_VERSION_MACROS_H__ */