1
/* GSVersionMacros.h - macros for managing API versioning and visibility
2
Copyright (C) 2006 Free Software Foundation, Inc.
4
Written by: Richard Frith-Macdonald <rfm@gnu.org>
5
Date: Oct, October 2006
7
This file is part of GNUstep.
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2 of the License, or (at your option) any later version.
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Library General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free
21
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22
Boston, MA 02110-1301, USA.
25
#ifndef __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_
26
#define __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_
28
/* By default we defined NO_GNUSTEP to 0 so that we will include extensions.
30
#if !defined(NO_GNUSTEP)
34
/* Check consistency of definitions for system compatibility.
36
#if defined(STRICT_OPENSTEP)
37
# define GS_OPENSTEP_V 10000
40
#elif defined(STRICT_MACOS_X)
41
# define GS_OPENSTEP_V 100600
47
* For MacOS-X compatibility, we define the MacOS-X version constants and
48
* we allow MAC_OS_X_VERSION_MIN_ALLOWED or MAC_OS_X_VERSION_MAX_ALLOWED
49
* instead of GS_OPENSTEP_V
52
#ifndef MAC_OS_X_VERSION_10_0
53
#define MAC_OS_X_VERSION_10_0 100000
54
#define MAC_OS_X_VERSION_10_1 100100
55
#define MAC_OS_X_VERSION_10_2 100200
56
#define MAC_OS_X_VERSION_10_3 100300
57
#define MAC_OS_X_VERSION_10_4 100400
58
#define MAC_OS_X_VERSION_10_5 100500
59
#define MAC_OS_X_VERSION_10_6 100600
60
#endif /* MAC_OS_X_VERSION_10_0 */
63
#ifdef MAC_OS_X_VERSION_MIN_ALLOWED
64
#define GS_OPENSTEP_V MAC_OS_X_VERSION_MIN_ALLOWED
66
#ifdef MAC_OS_X_VERSION_MAX_ALLOWED
67
#define GS_OPENSTEP_V MAC_OS_X_VERSION_MAX_ALLOWED
68
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
69
#endif /* MAC_OS_X_VERSION_MIN_ALLOWED */
70
#endif /* GS_OPENSTEP_V */
73
* NB. The version values below must be integers ... by convention these are
74
* made up of two digits each for major, minor and subminor version numbers
75
* (ie each is in the range 00 to 99 though a leading zero in the major
76
* number is not permitted).
77
* So for a MacOS-X 10.3.9 release the version number would be 100309
79
* You may define GS_GNUSTEP_V or GS_OPENSTEP_V to ensure that your
80
* program only 'sees' the specified varsion of the API.
84
* <p>Macro to check a defined GNUstep version number (GS_GNUSTEP_V) against
85
* the supplied arguments. Returns true if no GNUstep version is specified,
86
* or if ADD <= version < REM, where ADD is the version
87
* number at which a feature guarded by the macro was introduced and
88
* REM is the version number at which it was removed.
90
* <p>The version number arguments are six digit integers where the first
91
* two digits are the major version number, the second two are the minor
92
* version number and the last two are the subminor number (all left padded
93
* with a zero where necessary). However, for convenience you can also
94
* use any of several predefined constants ...
95
* <ref type="macro" id="GS_API_NONE">GS_API_NONE</ref>,
96
* <ref type="macro" id="GS_API_LATEST">GS_API_LATEST</ref>,
97
* <ref type="macro" id="GS_API_OSSPEC">GS_API_OSSPEC</ref>,
98
* <ref type="macro" id="GS_API_OPENSTEP">GS_API_OPENSTEP</ref>,
99
* <ref type="macro" id="GS_API_MACOSX">GS_API_MACOSX</ref>
101
* <p>Also see <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
103
* <p>NB. If you are changing the API (eg adding a new feature) you need
104
* to control the visibility io the new header file code using<br />
105
* <code>#if GS_API_VERSION(ADD,GS_API_LATEST)</code><br />
106
* where <code>ADD</code> is the version number of the next minor
107
* release after the most recent one.<br />
108
* As a general principle you should <em>not</em> change the API with
109
* changing subminor version numbers ... as that tends to confuse
110
* people (though Apple has sometimes done it).
113
#define GS_API_VERSION(ADD,REM) \
114
(!defined(GS_GNUSTEP_V) || (GS_GNUSTEP_V >= ADD && GS_GNUSTEP_V < REM))
117
* <p>Macro to check a defined OpenStep/OPENSTEP/MacOS-X version against the
118
* supplied arguments. Returns true if no version is specified, or if
119
* ADD <= version < REM, where ADD is the version
120
* number at which a feature guarded by the macro was introduced and
121
* REM is the version number at which it was removed.
123
* <p>The version number arguments are six digit integers where the first
124
* two digits are the major version number, the second two are the minor
125
* version number and the last two are the subminor number (all left padded
126
* with a zero where necessary). However, for convenience you can also
127
* use any of several predefined constants ...
128
* <ref type="macro" id="GS_API_NONE">GS_API_NONE</ref>,
129
* <ref type="macro" id="GS_API_LATEST">GS_API_LATEST</ref>,
130
* <ref type="macro" id="GS_API_OSSPEC">GS_API_OSSPEC</ref>,
131
* <ref type="macro" id="GS_API_OPENSTEP">GS_API_OPENSTEP</ref>,
132
* <ref type="macro" id="GS_API_MACOSX">GS_API_MACOSX</ref>
134
* <p>Also see <ref type="macro" id="GS_API_VERSION">GS_API_VERSION</ref>
137
#define OS_API_VERSION(ADD,REM) \
138
(!defined(GS_OPENSTEP_V) || (GS_OPENSTEP_V >= ADD && GS_OPENSTEP_V < REM))
141
* A constant which is the lowest possible version number (0) so that
142
* when used as the removal version (second argument of the GS_API_VERSION
143
* or OS_API_VERSION macro) represents a feature which is not present in
146
* #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
147
* (GS_API_NONE, GS_API_NONE)<br />
148
* denotes code not present in OpenStep/OPENSTEP/MacOS-X
150
#define GS_API_NONE 0
153
* A constant to represent a feature which is still present in the latest
154
* version. This is the highest possible version number.<br />
156
* #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
157
* (GS_API_MACOSX, GS_API_LATEST)<br />
158
* denotes code present from the initial MacOS-X version onwards.
160
#define GS_API_LATEST 999999
163
* The version number of the initial OpenStep specification.<br />
165
* #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
166
* (GS_API_OSSPEC, GS_API_LATEST)<br />
167
* denotes code present from the OpenStep specification onwards.
169
#define GS_API_OSSPEC 10000
172
* The version number of the first OPENSTEP implementation.<br />
174
* #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
175
* (GS_API_OPENSTEP, GS_API_LATEST)<br />
176
* denotes code present from the initial OPENSTEP version onwards.
178
#define GS_API_OPENSTEP 40000
181
* The version number of the first MacOS-X implementation.<br />
183
* #if <ref type="macro" id="OS_API_VERSION">OS_API_VERSION</ref>
184
* (GS_API_MACOSX, GS_API_LATEST)<br />
185
* denotes code present from the initial MacOS-X version onwards.
187
#define GS_API_MACOSX 100000
190
#if defined(GNUSTEP_BASE_INTERNAL)
191
#import "GNUstepBase/GSConfig.h"
193
#import <GNUstepBase/GSConfig.h>
196
#ifndef __has_feature
197
#define __has_feature(x) 0
200
/* The following is for deciding whether private instance variables
201
* should be visible ... if we are building with a compiler which
202
* does not define __has_feature then we know we don't have non-fragile
204
* In the header we bracket instance variable declarations in a
205
* '#if GS_EXPOSE(classname) ... #endif' sequence, so that the variables
206
* will not be visible to code which uses the library.
207
* In the source file we define EXPOSE_classname_IVARS to be 1
208
* before including the header, so that the ivars are always available
209
* in the class source itsself
213
# undef GS_NONFRAGILE
214
# define GS_NONFRAGILE 0 /* Mixed is treated as fragile */
216
# if (__has_feature(objc_nonfragile_abi))
218
# if defined(GNUSTEP_BASE_INTERNAL)
219
# error "You are building gnustep-base using the objc-nonfragile-abi but your gnustep-base was not configured to use it."
224
# error "Your gnustep-base was configured for the objc-nonfragile-abi but you are not using it now."
229
#define GS_EXPOSE(X) (!GS_NONFRAGILE || defined(EXPOSE_##X##_IVARS))
234
#if defined(GNUSTEP_WITH_DLL)
236
#if BUILD_libgnustep_base_DLL
238
# if defined(__MINGW__)
239
/* On Mingw, the compiler will export all symbols automatically, so
240
* __declspec(dllexport) is not needed.
242
# define GS_EXPORT extern
245
# define GS_EXPORT __declspec(dllexport)
246
# define GS_DECLARE __declspec(dllexport)
249
# define GS_EXPORT extern __declspec(dllimport)
250
# define GS_DECLARE __declspec(dllimport)
253
#else /* GNUSTEP_WITH[OUT]_DLL */
255
# define GS_EXPORT extern
260
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
261
#define GS_ATTRIB_DEPRECATED __attribute__ ((deprecated))
263
#define GS_ATTRIB_DEPRECATED
267
#endif /* __GNUSTEP_GSVERSIONMACROS_H_INCLUDED_ */