Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:42

0001 /* json-version-macros.h - JSON-GLib symbol versioning macros
0002  * 
0003  * This file is part of JSON-GLib
0004  * Copyright © 2014  Emmanuele Bassi
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef __JSON_VERSION_MACROS_H__
0021 #define __JSON_VERSION_MACROS_H__
0022 
0023 #if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
0024 #error "Only <json-glib/json-glib.h> can be included directly."
0025 #endif
0026 
0027 #include "json-version.h"
0028 
0029 #ifndef _JSON_EXTERN
0030 #define _JSON_EXTERN extern
0031 #endif
0032 
0033 #ifdef JSON_DISABLE_DEPRECATION_WARNINGS
0034 #define JSON_DEPRECATED _JSON_EXTERN
0035 #define JSON_DEPRECATED_FOR(f) _JSON_EXTERN
0036 #define JSON_UNAVAILABLE(maj,min) _JSON_EXTERN
0037 #else
0038 #define JSON_DEPRECATED G_DEPRECATED _JSON_EXTERN
0039 #define JSON_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _JSON_EXTERN
0040 #define JSON_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _JSON_EXTERN
0041 #endif
0042 
0043 /* XXX: Each new cycle should add a new version symbol here */
0044 /**
0045  * JSON_VERSION_1_0:
0046  *
0047  * The encoded representation of JSON-GLib version "1.0".
0048  */
0049 #define JSON_VERSION_1_0        (G_ENCODE_VERSION (1, 0))
0050 
0051 /**
0052  * JSON_VERSION_1_2:
0053  *
0054  * The encoded representation of JSON-GLib version "1.2".
0055  */
0056 #define JSON_VERSION_1_2        (G_ENCODE_VERSION (1, 2))
0057 
0058 /**
0059  * JSON_VERSION_1_4:
0060  *
0061  * The encoded representation of JSON-GLib version "1.4".
0062  */
0063 #define JSON_VERSION_1_4        (G_ENCODE_VERSION (1, 4))
0064 
0065 /**
0066  * JSON_VERSION_1_6:
0067  *
0068  * The encoded representation of JSON-GLib version "1.6".
0069  */
0070 #define JSON_VERSION_1_6        (G_ENCODE_VERSION (1, 6))
0071 
0072 /* evaluates to the current stable version; for development cycles,
0073  * this means the next stable target
0074  */
0075 #if (JSON_MINOR_VERSION == 99)
0076 #define JSON_VERSION_CUR_STABLE         (G_ENCODE_VERSION (JSON_MAJOR_VERSION + 1, 0))
0077 #elif (JSON_MINOR_VERSION % 2)
0078 #define JSON_VERSION_CUR_STABLE         (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION + 1))
0079 #else
0080 #define JSON_VERSION_CUR_STABLE         (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION))
0081 #endif
0082 
0083 /* evaluates to the previous stable version */
0084 #if (JSON_MINOR_VERSION == 99)
0085 #define JSON_VERSION_PREV_STABLE        (G_ENCODE_VERSION (JSON_MAJOR_VERSION + 1, 0))
0086 #elif (JSON_MINOR_VERSION % 2)
0087 #define JSON_VERSION_PREV_STABLE        (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION - 1))
0088 #else
0089 #define JSON_VERSION_PREV_STABLE        (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION - 2))
0090 #endif
0091 
0092 /**
0093  * JSON_VERSION_MIN_REQUIRED:
0094  *
0095  * A macro that should be defined by the user prior to including
0096  * the `json-glib/json-glib.h` header.
0097  *
0098  * The definition should be one of the predefined JSON-GLib version
0099  * macros: `JSON_VERSION_1_0`, `JSON_VERSION_1_2`, ...
0100  *
0101  * This macro defines the lower bound for the JSON-GLib API to use.
0102  *
0103  * If a function has been deprecated in a newer version of JSON-GLib,
0104  * it is possible to use this symbol to avoid the compiler warnings
0105  * without disabling warning for every deprecated function.
0106  *
0107  * Since: 1.0
0108  */
0109 #ifndef JSON_VERSION_MIN_REQUIRED
0110 # define JSON_VERSION_MIN_REQUIRED      (JSON_VERSION_CUR_STABLE)
0111 #endif
0112 
0113 /**
0114  * JSON_VERSION_MAX_ALLOWED:
0115  *
0116  * A macro that should be defined by the user prior to including
0117  * the `json-glib/json-glib.h` header.
0118 
0119  * The definition should be one of the predefined JSON-GLib version
0120  * macros: `JSON_VERSION_1_0`, `JSON_VERSION_1_2`, ...
0121  *
0122  * This macro defines the upper bound for the JSON API-GLib to use.
0123  *
0124  * If a function has been introduced in a newer version of JSON-GLib,
0125  * it is possible to use this symbol to get compiler warnings when
0126  * trying to use that function.
0127  *
0128  * Since: 1.0
0129  */
0130 #ifndef JSON_VERSION_MAX_ALLOWED
0131 # if JSON_VERSION_MIN_REQUIRED > JSON_VERSION_PREV_STABLE
0132 #  define JSON_VERSION_MAX_ALLOWED      (JSON_VERSION_MIN_REQUIRED)
0133 # else
0134 #  define JSON_VERSION_MAX_ALLOWED      (JSON_VERSION_CUR_STABLE)
0135 # endif
0136 #endif
0137 
0138 /* sanity checks */
0139 #if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_MIN_REQUIRED
0140 #error "JSON_VERSION_MAX_ALLOWED must be >= JSON_VERSION_MIN_REQUIRED"
0141 #endif
0142 #if JSON_VERSION_MIN_REQUIRED < JSON_VERSION_1_0
0143 #error "JSON_VERSION_MIN_REQUIRED must be >= JSON_VERSION_1_0"
0144 #endif
0145 
0146 /* XXX: Every new stable minor release should add a set of macros here */
0147 
0148 /* 1.0 */
0149 #if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_0
0150 # define JSON_DEPRECATED_IN_1_0                JSON_DEPRECATED
0151 # define JSON_DEPRECATED_IN_1_0_FOR(f)         JSON_DEPRECATED_FOR(f)
0152 #else
0153 # define JSON_DEPRECATED_IN_1_0                _JSON_EXTERN
0154 # define JSON_DEPRECATED_IN_1_0_FOR(f)         _JSON_EXTERN
0155 #endif
0156 
0157 #if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_0
0158 # define JSON_AVAILABLE_IN_1_0                 JSON_UNAVAILABLE(1, 0)
0159 #else
0160 # define JSON_AVAILABLE_IN_1_0                 _JSON_EXTERN
0161 #endif
0162 
0163 /* 1.2 */
0164 #if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_2
0165 # define JSON_DEPRECATED_IN_1_2                JSON_DEPRECATED
0166 # define JSON_DEPRECATED_IN_1_2_FOR(f)         JSON_DEPRECATED_FOR(f)
0167 #else
0168 # define JSON_DEPRECATED_IN_1_2                _JSON_EXTERN
0169 # define JSON_DEPRECATED_IN_1_2_FOR(f)         _JSON_EXTERN
0170 #endif
0171 
0172 #if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_2
0173 # define JSON_AVAILABLE_IN_1_2                 JSON_UNAVAILABLE(1, 2)
0174 #else
0175 # define JSON_AVAILABLE_IN_1_2                 _JSON_EXTERN
0176 #endif
0177 
0178 /* 1.4 */
0179 #if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_4
0180 # define JSON_DEPRECATED_IN_1_4                JSON_DEPRECATED
0181 # define JSON_DEPRECATED_IN_1_4_FOR(f)         JSON_DEPRECATED_FOR(f)
0182 #else
0183 # define JSON_DEPRECATED_IN_1_4                _JSON_EXTERN
0184 # define JSON_DEPRECATED_IN_1_4_FOR(f)         _JSON_EXTERN
0185 #endif
0186 
0187 #if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_4
0188 # define JSON_AVAILABLE_IN_1_4                 JSON_UNAVAILABLE(1, 4)
0189 #else
0190 # define JSON_AVAILABLE_IN_1_4                 _JSON_EXTERN
0191 #endif
0192 
0193 /* 1.6 */
0194 #if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_6
0195 # define JSON_DEPRECATED_IN_1_6                JSON_DEPRECATED
0196 # define JSON_DEPRECATED_IN_1_6_FOR(f)         JSON_DEPRECATED_FOR(f)
0197 #else
0198 # define JSON_DEPRECATED_IN_1_6                _JSON_EXTERN
0199 # define JSON_DEPRECATED_IN_1_6_FOR(f)         _JSON_EXTERN
0200 #endif
0201 
0202 #if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_6
0203 # define JSON_AVAILABLE_IN_1_6                 JSON_UNAVAILABLE(1, 6)
0204 #else
0205 # define JSON_AVAILABLE_IN_1_6                 _JSON_EXTERN
0206 #endif
0207 
0208 #endif /* __JSON_VERSION_MACROS_H__ */