gversionmacros.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. /* GLIB - Library of useful routines for C programming
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /*
  20. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GLib Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #ifndef __G_VERSION_MACROS_H__
  26. #define __G_VERSION_MACROS_H__
  27. #if !defined(__GLIB_H_INSIDE__) && !defined(GLIB_COMPILATION)
  28. #error "Only <glib.h> can be included directly."
  29. #endif
  30. /* Version boundaries checks */
  31. #define G_ENCODE_VERSION(major, minor) ((major) << 16 | (minor) << 8)
  32. /**
  33. * GLIB_VERSION_2_2:
  34. *
  35. * A macro that evaluates to the 2.2 version of GLib, in a format
  36. * that can be used by the C pre-processor.
  37. *
  38. * Since: 2.32
  39. */
  40. #define GLIB_VERSION_2_2 (G_ENCODE_VERSION (2, 2))
  41. /**
  42. * GLIB_VERSION_2_4:
  43. *
  44. * A macro that evaluates to the 2.4 version of GLib, in a format
  45. * that can be used by the C pre-processor.
  46. *
  47. * Since: 2.32
  48. */
  49. #define GLIB_VERSION_2_4 (G_ENCODE_VERSION (2, 4))
  50. /**
  51. * GLIB_VERSION_2_6:
  52. *
  53. * A macro that evaluates to the 2.6 version of GLib, in a format
  54. * that can be used by the C pre-processor.
  55. *
  56. * Since: 2.32
  57. */
  58. #define GLIB_VERSION_2_6 (G_ENCODE_VERSION (2, 6))
  59. /**
  60. * GLIB_VERSION_2_8:
  61. *
  62. * A macro that evaluates to the 2.8 version of GLib, in a format
  63. * that can be used by the C pre-processor.
  64. *
  65. * Since: 2.32
  66. */
  67. #define GLIB_VERSION_2_8 (G_ENCODE_VERSION (2, 8))
  68. /**
  69. * GLIB_VERSION_2_10:
  70. *
  71. * A macro that evaluates to the 2.10 version of GLib, in a format
  72. * that can be used by the C pre-processor.
  73. *
  74. * Since: 2.32
  75. */
  76. #define GLIB_VERSION_2_10 (G_ENCODE_VERSION (2, 10))
  77. /**
  78. * GLIB_VERSION_2_12:
  79. *
  80. * A macro that evaluates to the 2.12 version of GLib, in a format
  81. * that can be used by the C pre-processor.
  82. *
  83. * Since: 2.32
  84. */
  85. #define GLIB_VERSION_2_12 (G_ENCODE_VERSION (2, 12))
  86. /**
  87. * GLIB_VERSION_2_14:
  88. *
  89. * A macro that evaluates to the 2.14 version of GLib, in a format
  90. * that can be used by the C pre-processor.
  91. *
  92. * Since: 2.32
  93. */
  94. #define GLIB_VERSION_2_14 (G_ENCODE_VERSION (2, 14))
  95. /**
  96. * GLIB_VERSION_2_16:
  97. *
  98. * A macro that evaluates to the 2.16 version of GLib, in a format
  99. * that can be used by the C pre-processor.
  100. *
  101. * Since: 2.32
  102. */
  103. #define GLIB_VERSION_2_16 (G_ENCODE_VERSION (2, 16))
  104. /**
  105. * GLIB_VERSION_2_18:
  106. *
  107. * A macro that evaluates to the 2.18 version of GLib, in a format
  108. * that can be used by the C pre-processor.
  109. *
  110. * Since: 2.32
  111. */
  112. #define GLIB_VERSION_2_18 (G_ENCODE_VERSION (2, 18))
  113. /**
  114. * GLIB_VERSION_2_20:
  115. *
  116. * A macro that evaluates to the 2.20 version of GLib, in a format
  117. * that can be used by the C pre-processor.
  118. *
  119. * Since: 2.32
  120. */
  121. #define GLIB_VERSION_2_20 (G_ENCODE_VERSION (2, 20))
  122. /**
  123. * GLIB_VERSION_2_22:
  124. *
  125. * A macro that evaluates to the 2.22 version of GLib, in a format
  126. * that can be used by the C pre-processor.
  127. *
  128. * Since: 2.32
  129. */
  130. #define GLIB_VERSION_2_22 (G_ENCODE_VERSION (2, 22))
  131. /**
  132. * GLIB_VERSION_2_24:
  133. *
  134. * A macro that evaluates to the 2.24 version of GLib, in a format
  135. * that can be used by the C pre-processor.
  136. *
  137. * Since: 2.32
  138. */
  139. #define GLIB_VERSION_2_24 (G_ENCODE_VERSION (2, 24))
  140. /**
  141. * GLIB_VERSION_2_26:
  142. *
  143. * A macro that evaluates to the 2.26 version of GLib, in a format
  144. * that can be used by the C pre-processor.
  145. *
  146. * Since: 2.32
  147. */
  148. #define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))
  149. /**
  150. * GLIB_VERSION_2_28:
  151. *
  152. * A macro that evaluates to the 2.28 version of GLib, in a format
  153. * that can be used by the C pre-processor.
  154. *
  155. * Since: 2.32
  156. */
  157. #define GLIB_VERSION_2_28 (G_ENCODE_VERSION (2, 28))
  158. /**
  159. * GLIB_VERSION_2_30:
  160. *
  161. * A macro that evaluates to the 2.30 version of GLib, in a format
  162. * that can be used by the C pre-processor.
  163. *
  164. * Since: 2.32
  165. */
  166. #define GLIB_VERSION_2_30 (G_ENCODE_VERSION (2, 30))
  167. /**
  168. * GLIB_VERSION_2_32:
  169. *
  170. * A macro that evaluates to the 2.32 version of GLib, in a format
  171. * that can be used by the C pre-processor.
  172. *
  173. * Since: 2.32
  174. */
  175. #define GLIB_VERSION_2_32 (G_ENCODE_VERSION (2, 32))
  176. /**
  177. * GLIB_VERSION_2_34:
  178. *
  179. * A macro that evaluates to the 2.34 version of GLib, in a format
  180. * that can be used by the C pre-processor.
  181. *
  182. * Since: 2.34
  183. */
  184. #define GLIB_VERSION_2_34 (G_ENCODE_VERSION (2, 34))
  185. /**
  186. * GLIB_VERSION_2_36:
  187. *
  188. * A macro that evaluates to the 2.36 version of GLib, in a format
  189. * that can be used by the C pre-processor.
  190. *
  191. * Since: 2.36
  192. */
  193. #define GLIB_VERSION_2_36 (G_ENCODE_VERSION (2, 36))
  194. /**
  195. * GLIB_VERSION_2_38:
  196. *
  197. * A macro that evaluates to the 2.38 version of GLib, in a format
  198. * that can be used by the C pre-processor.
  199. *
  200. * Since: 2.38
  201. */
  202. #define GLIB_VERSION_2_38 (G_ENCODE_VERSION (2, 38))
  203. /**
  204. * GLIB_VERSION_2_40:
  205. *
  206. * A macro that evaluates to the 2.40 version of GLib, in a format
  207. * that can be used by the C pre-processor.
  208. *
  209. * Since: 2.40
  210. */
  211. #define GLIB_VERSION_2_40 (G_ENCODE_VERSION (2, 40))
  212. /**
  213. * GLIB_VERSION_2_42:
  214. *
  215. * A macro that evaluates to the 2.42 version of GLib, in a format
  216. * that can be used by the C pre-processor.
  217. *
  218. * Since: 2.42
  219. */
  220. #define GLIB_VERSION_2_42 (G_ENCODE_VERSION (2, 42))
  221. /**
  222. * GLIB_VERSION_2_44:
  223. *
  224. * A macro that evaluates to the 2.44 version of GLib, in a format
  225. * that can be used by the C pre-processor.
  226. *
  227. * Since: 2.44
  228. */
  229. #define GLIB_VERSION_2_44 (G_ENCODE_VERSION (2, 44))
  230. /**
  231. * GLIB_VERSION_2_46:
  232. *
  233. * A macro that evaluates to the 2.46 version of GLib, in a format
  234. * that can be used by the C pre-processor.
  235. *
  236. * Since: 2.46
  237. */
  238. #define GLIB_VERSION_2_46 (G_ENCODE_VERSION (2, 46))
  239. /**
  240. * GLIB_VERSION_2_48:
  241. *
  242. * A macro that evaluates to the 2.48 version of GLib, in a format
  243. * that can be used by the C pre-processor.
  244. *
  245. * Since: 2.48
  246. */
  247. #define GLIB_VERSION_2_48 (G_ENCODE_VERSION (2, 48))
  248. /**
  249. * GLIB_VERSION_2_50:
  250. *
  251. * A macro that evaluates to the 2.50 version of GLib, in a format
  252. * that can be used by the C pre-processor.
  253. *
  254. * Since: 2.50
  255. */
  256. #define GLIB_VERSION_2_50 (G_ENCODE_VERSION (2, 50))
  257. /**
  258. * GLIB_VERSION_2_52:
  259. *
  260. * A macro that evaluates to the 2.52 version of GLib, in a format
  261. * that can be used by the C pre-processor.
  262. *
  263. * Since: 2.52
  264. */
  265. #define GLIB_VERSION_2_52 (G_ENCODE_VERSION (2, 52))
  266. /**
  267. * GLIB_VERSION_2_54:
  268. *
  269. * A macro that evaluates to the 2.54 version of GLib, in a format
  270. * that can be used by the C pre-processor.
  271. *
  272. * Since: 2.54
  273. */
  274. #define GLIB_VERSION_2_54 (G_ENCODE_VERSION (2, 54))
  275. /**
  276. * GLIB_VERSION_2_56:
  277. *
  278. * A macro that evaluates to the 2.56 version of GLib, in a format
  279. * that can be used by the C pre-processor.
  280. *
  281. * Since: 2.56
  282. */
  283. #define GLIB_VERSION_2_56 (G_ENCODE_VERSION (2, 56))
  284. /**
  285. * GLIB_VERSION_2_58:
  286. *
  287. * A macro that evaluates to the 2.58 version of GLib, in a format
  288. * that can be used by the C pre-processor.
  289. *
  290. * Since: 2.58
  291. */
  292. #define GLIB_VERSION_2_58 (G_ENCODE_VERSION (2, 58))
  293. /**
  294. * GLIB_VERSION_2_60:
  295. *
  296. * A macro that evaluates to the 2.60 version of GLib, in a format
  297. * that can be used by the C pre-processor.
  298. *
  299. * Since: 2.60
  300. */
  301. #define GLIB_VERSION_2_60 (G_ENCODE_VERSION (2, 60))
  302. /**
  303. * GLIB_VERSION_2_62:
  304. *
  305. * A macro that evaluates to the 2.62 version of GLib, in a format
  306. * that can be used by the C pre-processor.
  307. *
  308. * Since: 2.62
  309. */
  310. #define GLIB_VERSION_2_62 (G_ENCODE_VERSION (2, 62))
  311. /**
  312. * GLIB_VERSION_2_64:
  313. *
  314. * A macro that evaluates to the 2.64 version of GLib, in a format
  315. * that can be used by the C pre-processor.
  316. *
  317. * Since: 2.64
  318. */
  319. #define GLIB_VERSION_2_64 (G_ENCODE_VERSION (2, 64))
  320. /**
  321. * GLIB_VERSION_2_66:
  322. *
  323. * A macro that evaluates to the 2.66 version of GLib, in a format
  324. * that can be used by the C pre-processor.
  325. *
  326. * Since: 2.66
  327. */
  328. #define GLIB_VERSION_2_66 (G_ENCODE_VERSION (2, 66))
  329. /**
  330. * GLIB_VERSION_2_68:
  331. *
  332. * A macro that evaluates to the 2.68 version of GLib, in a format
  333. * that can be used by the C pre-processor.
  334. *
  335. * Since: 2.68
  336. */
  337. #define GLIB_VERSION_2_68 (G_ENCODE_VERSION (2, 68))
  338. /**
  339. * GLIB_VERSION_2_70:
  340. *
  341. * A macro that evaluates to the 2.70 version of GLib, in a format
  342. * that can be used by the C pre-processor.
  343. *
  344. * Since: 2.70
  345. */
  346. #define GLIB_VERSION_2_70 (G_ENCODE_VERSION (2, 70))
  347. /**
  348. * GLIB_VERSION_2_72:
  349. *
  350. * A macro that evaluates to the 2.72 version of GLib, in a format
  351. * that can be used by the C pre-processor.
  352. *
  353. * Since: 2.72
  354. */
  355. #define GLIB_VERSION_2_72 (G_ENCODE_VERSION (2, 72))
  356. /**
  357. * GLIB_VERSION_2_74:
  358. *
  359. * A macro that evaluates to the 2.74 version of GLib, in a format
  360. * that can be used by the C pre-processor.
  361. *
  362. * Since: 2.74
  363. */
  364. #define GLIB_VERSION_2_74 (G_ENCODE_VERSION (2, 74))
  365. /**
  366. * GLIB_VERSION_2_76:
  367. *
  368. * A macro that evaluates to the 2.76 version of GLib, in a format
  369. * that can be used by the C pre-processor.
  370. *
  371. * Since: 2.76
  372. */
  373. #define GLIB_VERSION_2_76 (G_ENCODE_VERSION (2, 76))
  374. /**
  375. * GLIB_VERSION_2_78:
  376. *
  377. * A macro that evaluates to the 2.78 version of GLib, in a format
  378. * that can be used by the C pre-processor.
  379. *
  380. * Since: 2.78
  381. */
  382. #define GLIB_VERSION_2_78 (G_ENCODE_VERSION (2, 78))
  383. /**
  384. * GLIB_VERSION_2_80:
  385. *
  386. * A macro that evaluates to the 2.80 version of GLib, in a format
  387. * that can be used by the C pre-processor.
  388. *
  389. * Since: 2.80
  390. */
  391. #define GLIB_VERSION_2_80 (G_ENCODE_VERSION (2, 80))
  392. /**
  393. * GLIB_VERSION_2_82:
  394. *
  395. * A macro that evaluates to the 2.82 version of GLib, in a format
  396. * that can be used by the C pre-processor.
  397. *
  398. * Since: 2.82
  399. */
  400. #define GLIB_VERSION_2_82 (G_ENCODE_VERSION (2, 82))
  401. /**
  402. * GLIB_VERSION_CUR_STABLE:
  403. *
  404. * A macro that evaluates to the current stable version of GLib, in a format
  405. * that can be used by the C pre-processor.
  406. *
  407. * During an unstable development cycle, this evaluates to the next stable
  408. * (unreleased) version which will be the result of the development cycle.
  409. *
  410. * Since: 2.32
  411. */
  412. #if (GLIB_MINOR_VERSION % 2)
  413. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION + 1))
  414. #else
  415. #define GLIB_VERSION_CUR_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION))
  416. #endif
  417. /**
  418. * GLIB_VERSION_PREV_STABLE:
  419. *
  420. * A macro that evaluates to the previous stable version of GLib, in a format
  421. * that can be used by the C pre-processor.
  422. *
  423. * During an unstable development cycle, this evaluates to the most recent
  424. * released stable release, which preceded this development cycle.
  425. *
  426. * Since: 2.32
  427. */
  428. #if (GLIB_MINOR_VERSION % 2)
  429. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 1))
  430. #else
  431. #define GLIB_VERSION_PREV_STABLE (G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION - 2))
  432. #endif
  433. /**
  434. * GLIB_VERSION_MIN_REQUIRED:
  435. *
  436. * A macro that should be defined by the user prior to including
  437. * the glib.h header.
  438. * The definition should be one of the predefined GLib version
  439. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  440. *
  441. * This macro defines the earliest version of GLib that the package is
  442. * required to be able to compile against.
  443. *
  444. * If the compiler is configured to warn about the use of deprecated
  445. * functions, then using functions that were deprecated in version
  446. * %GLIB_VERSION_MIN_REQUIRED or earlier will cause warnings (but
  447. * using functions deprecated in later releases will not).
  448. *
  449. * Since: 2.32
  450. */
  451. /* If the package sets GLIB_VERSION_MIN_REQUIRED to some future
  452. * GLIB_VERSION_X_Y value that we don't know about, it will compare as
  453. * 0 in preprocessor tests.
  454. */
  455. #ifndef GLIB_VERSION_MIN_REQUIRED
  456. #define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE)
  457. #elif GLIB_VERSION_MIN_REQUIRED == 0
  458. #undef GLIB_VERSION_MIN_REQUIRED
  459. #define GLIB_VERSION_MIN_REQUIRED (GLIB_VERSION_CUR_STABLE + 2)
  460. #endif
  461. /**
  462. * GLIB_VERSION_MAX_ALLOWED:
  463. *
  464. * A macro that should be defined by the user prior to including
  465. * the glib.h header.
  466. * The definition should be one of the predefined GLib version
  467. * macros: %GLIB_VERSION_2_26, %GLIB_VERSION_2_28,...
  468. *
  469. * This macro defines the latest version of the GLib API that the
  470. * package is allowed to make use of.
  471. *
  472. * If the compiler is configured to warn about the use of deprecated
  473. * functions, then using functions added after version
  474. * %GLIB_VERSION_MAX_ALLOWED will cause warnings.
  475. *
  476. * Unless you are using GLIB_CHECK_VERSION() or the like to compile
  477. * different code depending on the GLib version, then this should be
  478. * set to the same value as %GLIB_VERSION_MIN_REQUIRED.
  479. *
  480. * Since: 2.32
  481. */
  482. #if !defined(GLIB_VERSION_MAX_ALLOWED) || (GLIB_VERSION_MAX_ALLOWED == 0)
  483. #undef GLIB_VERSION_MAX_ALLOWED
  484. #define GLIB_VERSION_MAX_ALLOWED (GLIB_VERSION_CUR_STABLE)
  485. #endif
  486. /* sanity checks */
  487. #if GLIB_VERSION_MIN_REQUIRED > GLIB_VERSION_CUR_STABLE
  488. #error "GLIB_VERSION_MIN_REQUIRED must be <= GLIB_VERSION_CUR_STABLE"
  489. #endif
  490. #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_MIN_REQUIRED
  491. #error "GLIB_VERSION_MAX_ALLOWED must be >= GLIB_VERSION_MIN_REQUIRED"
  492. #endif
  493. #if GLIB_VERSION_MIN_REQUIRED < GLIB_VERSION_2_26
  494. #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"
  495. #endif
  496. #endif /* __G_VERSION_MACROS_H__ */