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