gversionmacros.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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. /* evaluates to the current stable version; for development cycles,
  104. * this means the next stable target
  105. */
  106. #if (GLIB_MINOR_VERSION % 2)
  107. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
  108. #else
  109. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
  110. #endif
  111. /* evaluates to the previous stable version */
  112. #if (GLIB_MINOR_VERSION % 2)
  113. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
  114. #else
  115. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
  116. #endif
  117. /**
  118. * GLIB_VERSION_MIN_REQUIRED:
  119. *
  120. * A macro that should be defined by the user prior to including
  121. * the glib.h header.
  122. * The definition should be one of the predefined GLib version
  123. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  124. *
  125. * This macro defines the earliest version of GLib that the package is
  126. * required to be able to compile against.
  127. *
  128. * If the compiler is configured to warn about the use of deprecated
  129. * functions, then using functions that were deprecated in version
  130. * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
  131. * using functions deprecated in later releases will not).
  132. *
  133. * Since: 2.32
  134. */
  135. /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
  136. * GLIB_VERSION_X_Y value that we don't know about, it will compare as
  137. * 0 in preprocessor tests.
  138. */
  139. #ifndef GLIB_VERSION_MIN_REQUIRED
  140. # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
  141. #elif GLIB_VERSION_MIN_REQUIRED == 0
  142. # undef GLIB_VERSION_MIN_REQUIRED
  143. # define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
  144. #endif
  145. /**
  146. * GLIB_VERSION_MAX_ALLOWED:
  147. *
  148. * A macro that should be defined by the user prior to including
  149. * the glib.h header.
  150. * The definition should be one of the predefined GLib version
  151. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  152. *
  153. * This macro defines the latest version of the GLib API that the
  154. * package is allowed to make use of.
  155. *
  156. * If the compiler is configured to warn about the use of deprecated
  157. * functions, then using functions added after version
  158. * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
  159. *
  160. * Unless you are using GLIB_CHECK_VERSION() or the like to compile
  161. * different code depending on the GLib version, then this should be
  162. * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
  163. *
  164. * Since: 2.32
  165. */
  166. #if !defined (GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
  167. # undef GLIB_VERSION_MAX_ALLOWED
  168. # define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
  169. #endif
  170. /* sanity checks */
  171. #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
  172. #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
  173. #endif
  174. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
  175. #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
  176. #endif
  177. #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
  178. #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
  179. #endif
  180. /* These macros are used to mark deprecated functions in GLib headers,
  181. * and thus have to be exposed in installed headers. But please
  182. * do *not* use them in other projects. Instead, use G_DEPRECATED
  183. * or define your own wrappers around it.
  184. */
  185. #define GLIB_AVAILABLE_IN_ALL _GLIB_EXTERN
  186. /* XXX: Every new stable minor release should add a set of macros here */
  187. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26
  188. # define GLIB_DEPRECATED_IN_2_26 GLIB_DEPRECATED
  189. # define GLIB_DEPRECATED_IN_2_26_FOR(f) GLIB_DEPRECATED_FOR(f)
  190. #else
  191. # define GLIB_DEPRECATED_IN_2_26 _GLIB_EXTERN
  192. # define GLIB_DEPRECATED_IN_2_26_FOR(f) _GLIB_EXTERN
  193. #endif
  194. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26
  195. # define GLIB_AVAILABLE_IN_2_26 GLIB_UNAVAILABLE(2, 26)
  196. #else
  197. # define GLIB_AVAILABLE_IN_2_26 _GLIB_EXTERN
  198. #endif
  199. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28
  200. # define GLIB_DEPRECATED_IN_2_28 GLIB_DEPRECATED
  201. # define GLIB_DEPRECATED_IN_2_28_FOR(f) GLIB_DEPRECATED_FOR(f)
  202. #else
  203. # define GLIB_DEPRECATED_IN_2_28 _GLIB_EXTERN
  204. # define GLIB_DEPRECATED_IN_2_28_FOR(f) _GLIB_EXTERN
  205. #endif
  206. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28
  207. # define GLIB_AVAILABLE_IN_2_28 GLIB_UNAVAILABLE(2, 28)
  208. #else
  209. # define GLIB_AVAILABLE_IN_2_28 _GLIB_EXTERN
  210. #endif
  211. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30
  212. # define GLIB_DEPRECATED_IN_2_30 GLIB_DEPRECATED
  213. # define GLIB_DEPRECATED_IN_2_30_FOR(f) GLIB_DEPRECATED_FOR(f)
  214. #else
  215. # define GLIB_DEPRECATED_IN_2_30 _GLIB_EXTERN
  216. # define GLIB_DEPRECATED_IN_2_30_FOR(f) _GLIB_EXTERN
  217. #endif
  218. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30
  219. # define GLIB_AVAILABLE_IN_2_30 GLIB_UNAVAILABLE(2, 30)
  220. #else
  221. # define GLIB_AVAILABLE_IN_2_30 _GLIB_EXTERN
  222. #endif
  223. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32
  224. # define GLIB_DEPRECATED_IN_2_32 GLIB_DEPRECATED
  225. # define GLIB_DEPRECATED_IN_2_32_FOR(f) GLIB_DEPRECATED_FOR(f)
  226. #else
  227. # define GLIB_DEPRECATED_IN_2_32 _GLIB_EXTERN
  228. # define GLIB_DEPRECATED_IN_2_32_FOR(f) _GLIB_EXTERN
  229. #endif
  230. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32
  231. # define GLIB_AVAILABLE_IN_2_32 GLIB_UNAVAILABLE(2, 32)
  232. #else
  233. # define GLIB_AVAILABLE_IN_2_32 _GLIB_EXTERN
  234. #endif
  235. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34
  236. # define GLIB_DEPRECATED_IN_2_34 GLIB_DEPRECATED
  237. # define GLIB_DEPRECATED_IN_2_34_FOR(f) GLIB_DEPRECATED_FOR(f)
  238. #else
  239. # define GLIB_DEPRECATED_IN_2_34 _GLIB_EXTERN
  240. # define GLIB_DEPRECATED_IN_2_34_FOR(f) _GLIB_EXTERN
  241. #endif
  242. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34
  243. # define GLIB_AVAILABLE_IN_2_34 GLIB_UNAVAILABLE(2, 34)
  244. #else
  245. # define GLIB_AVAILABLE_IN_2_34 _GLIB_EXTERN
  246. #endif
  247. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36
  248. # define GLIB_DEPRECATED_IN_2_36 GLIB_DEPRECATED
  249. # define GLIB_DEPRECATED_IN_2_36_FOR(f) GLIB_DEPRECATED_FOR(f)
  250. #else
  251. # define GLIB_DEPRECATED_IN_2_36 _GLIB_EXTERN
  252. # define GLIB_DEPRECATED_IN_2_36_FOR(f) _GLIB_EXTERN
  253. #endif
  254. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36
  255. # define GLIB_AVAILABLE_IN_2_36 GLIB_UNAVAILABLE(2, 36)
  256. #else
  257. # define GLIB_AVAILABLE_IN_2_36 _GLIB_EXTERN
  258. #endif
  259. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38
  260. # define GLIB_DEPRECATED_IN_2_38 GLIB_DEPRECATED
  261. # define GLIB_DEPRECATED_IN_2_38_FOR(f) GLIB_DEPRECATED_FOR(f)
  262. #else
  263. # define GLIB_DEPRECATED_IN_2_38 _GLIB_EXTERN
  264. # define GLIB_DEPRECATED_IN_2_38_FOR(f) _GLIB_EXTERN
  265. #endif
  266. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
  267. # define GLIB_AVAILABLE_IN_2_38 GLIB_UNAVAILABLE(2, 38)
  268. #else
  269. # define GLIB_AVAILABLE_IN_2_38 _GLIB_EXTERN
  270. #endif
  271. #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40
  272. # define GLIB_DEPRECATED_IN_2_40 GLIB_DEPRECATED
  273. # define GLIB_DEPRECATED_IN_2_40_FOR(f) GLIB_DEPRECATED_FOR(f)
  274. #else
  275. # define GLIB_DEPRECATED_IN_2_40 _GLIB_EXTERN
  276. # define GLIB_DEPRECATED_IN_2_40_FOR(f) _GLIB_EXTERN
  277. #endif
  278. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40
  279. # define GLIB_AVAILABLE_IN_2_40 GLIB_UNAVAILABLE(2, 40)
  280. #else
  281. # define GLIB_AVAILABLE_IN_2_40 _GLIB_EXTERN
  282. #endif
  283. #endif /* __G_VERSION_MACROS_H__ */