1 | /* |
2 | * "$Id: versioning.h 11056 2013-06-25 14:27:30Z msweet $" |
3 | * |
4 | * API versioning definitions for CUPS. |
5 | * |
6 | * Copyright 2007-2013 by Apple Inc. |
7 | * |
8 | * These coded instructions, statements, and computer programs are the |
9 | * property of Apple Inc. and are protected by Federal copyright |
10 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" |
11 | * which should have been included with this file. If this file is |
12 | * file is missing or damaged, see the license at "http://www.cups.org/". |
13 | * |
14 | * This file is subject to the Apple OS-Developed Software exception. |
15 | */ |
16 | |
17 | #ifndef _CUPS_VERSIONING_H_ |
18 | # define _CUPS_VERSIONING_H_ |
19 | |
20 | /* |
21 | * This header defines several constants - _CUPS_DEPRECATED, |
22 | * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_1_1, _CUPS_API_1_1_19, |
23 | * _CUPS_API_1_1_20, _CUPS_API_1_1_21, _CUPS_API_1_2, _CUPS_API_1_3, |
24 | * _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, and _CUPS_API_1_7 - which add |
25 | * compiler-specific attributes that flag functions that are deprecated, added |
26 | * in particular releases, or internal to CUPS. |
27 | * |
28 | * On OS X, the _CUPS_API_* constants are defined based on the values of |
29 | * the MAC_OS_X_VERSION_MIN_ALLOWED and MAC_OS_X_VERSION_MAX_ALLOWED constants |
30 | * provided by the compiler. |
31 | */ |
32 | |
33 | # if defined(__APPLE__) && !defined(_CUPS_SOURCE) |
34 | # include <AvailabilityMacros.h> |
35 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER |
36 | # define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER __attribute__((unavailable)) |
37 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER */ |
38 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER |
39 | # define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER __attribute__((unavailable)) |
40 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER */ |
41 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER |
42 | # define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER __attribute__((unavailable)) |
43 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER */ |
44 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
45 | # define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER __attribute__((unavailable)) |
46 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER */ |
47 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER |
48 | # define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER __attribute__((unavailable)) |
49 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER */ |
50 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER |
51 | # define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER __attribute__((unavailable)) |
52 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER */ |
53 | # ifndef AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER |
54 | # define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER __attribute__((unavailable)) |
55 | # endif /* !AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER */ |
56 | # define _CUPS_API_1_1_19 AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER |
57 | # define _CUPS_API_1_1_20 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER |
58 | # define _CUPS_API_1_1_21 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER |
59 | # define _CUPS_API_1_2 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER |
60 | # define _CUPS_API_1_3 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER |
61 | # define _CUPS_API_1_4 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
62 | # define _CUPS_API_1_5 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER |
63 | # define _CUPS_API_1_6 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER |
64 | # define _CUPS_API_1_7 AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER |
65 | # else |
66 | # define _CUPS_API_1_1_19 |
67 | # define _CUPS_API_1_1_20 |
68 | # define _CUPS_API_1_1_21 |
69 | # define _CUPS_API_1_2 |
70 | # define _CUPS_API_1_3 |
71 | # define _CUPS_API_1_4 |
72 | # define _CUPS_API_1_5 |
73 | # define _CUPS_API_1_6 |
74 | # define _CUPS_API_1_7 |
75 | # endif /* __APPLE__ && !_CUPS_SOURCE */ |
76 | |
77 | /* |
78 | * With GCC and Clang we can mark old APIs as "deprecated" or "unavailable" with |
79 | * messages so you get warnings/errors are compile-time... |
80 | */ |
81 | |
82 | # ifdef __has_extension /* Clang */ |
83 | # define _CUPS_HAS_DEPRECATED |
84 | # if __has_extension(attribute_deprecated_with_message) |
85 | # define _CUPS_HAS_DEPRECATED_WITH_MESSAGE |
86 | # endif |
87 | # if __has_extension(attribute_unavailable_with_message) |
88 | # define _CUPS_HAS_UNAVAILABLE_WITH_MESSAGE |
89 | # endif |
90 | # elif defined(__GNUC__) /* GCC and compatible */ |
91 | # if __GNUC__ >= 3 /* GCC 3.0 or higher */ |
92 | # define _CUPS_HAS_DEPRECATED |
93 | # endif /* __GNUC__ >= 3 */ |
94 | # if __GNUC__ >= 5 /* GCC 5.x */ |
95 | # define _CUPS_HAS_DEPRECATED_WITH_MESSAGE |
96 | # elif __GNUC__ == 4 && __GNUC_MINOR__ >= 5 |
97 | /* GCC 4.5 or higher */ |
98 | # define _CUPS_HAS_DEPRECATED_WITH_MESSAGE |
99 | # endif /* __GNUC__ >= 5 */ |
100 | # endif /* __has_extension */ |
101 | |
102 | # if !defined(_CUPS_HAS_DEPRECATED) || (defined(_CUPS_SOURCE) && !defined(_CUPS_NO_DEPRECATED)) |
103 | /* |
104 | * Don't mark functions deprecated if the compiler doesn't support it |
105 | * or we are building CUPS source that doesn't care. |
106 | */ |
107 | # define _CUPS_DEPRECATED |
108 | # define _CUPS_DEPRECATED_MSG(m) |
109 | # define _CUPS_DEPRECATED_1_6_MSG(m) |
110 | # define _CUPS_DEPRECATED_1_7_MSG(m) |
111 | # define _CUPS_INTERNAL_MSG(m) |
112 | # elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) && defined(_CUPS_NO_DEPRECATED) |
113 | /* |
114 | * Compiler supports the unavailable attribute, so use it when the code |
115 | * wants to exclude the use of deprecated API. |
116 | */ |
117 | # define _CUPS_DEPRECATED __attribute__ ((unavailable)) |
118 | # define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m))) |
119 | # define _CUPS_DEPRECATED_1_6_MSG(m) __attribute__ ((unavailable(m))) |
120 | # define _CUPS_DEPRECATED_1_7_MSG(m) __attribute__ ((unavailable(m))) |
121 | # define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) |
122 | # else |
123 | /* |
124 | * Compiler supports the deprecated attribute, so use it. |
125 | */ |
126 | # define _CUPS_DEPRECATED __attribute__ ((deprecated)) |
127 | # ifdef _CUPS_HAS_DEPRECATED_WITH_MESSAGE |
128 | # define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m))) |
129 | # else |
130 | # define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated)) |
131 | # endif /* _CUPS_HAS_DEPRECATED_WITH_MESSAGE */ |
132 | # if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 |
133 | # define _CUPS_DEPRECATED_1_6_MSG(m) _CUPS_DEPRECATED_MSG(m) |
134 | # else |
135 | # define _CUPS_DEPRECATED_1_6_MSG(m) |
136 | # endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8 */ |
137 | # if defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 |
138 | # define _CUPS_DEPRECATED_1_7_MSG(m) _CUPS_DEPRECATED_MSG(m) |
139 | # else |
140 | # define _CUPS_DEPRECATED_1_7_MSG(m) |
141 | # endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 */ |
142 | # ifdef _CUPS_SOURCE |
143 | # define _CUPS_INTERNAL_MSG(m) |
144 | # elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) |
145 | # define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m))) |
146 | # elif defined(_CUPS_HAS_DEPRECATED_WITH_MESSAGE) |
147 | # define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated(m))) |
148 | # else |
149 | # define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated)) |
150 | # endif /* _CUPS_SOURCE */ |
151 | # endif /* !_CUPS_HAS_DEPRECATED || (_CUPS_SOURCE && !_CUPS_NO_DEPRECATED) */ |
152 | |
153 | # ifndef __GNUC__ |
154 | # define __attribute__(x) |
155 | # endif /* !__GNUC__ */ |
156 | |
157 | #endif /* !_CUPS_VERSIONING_H_ */ |
158 | |
159 | /* |
160 | * End of "$Id: versioning.h 11056 2013-06-25 14:27:30Z msweet $". |
161 | */ |
162 | |