]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/make_posix_availability.sh
xnu-3789.1.32.tar.gz
[apple/xnu.git] / bsd / sys / make_posix_availability.sh
1 #! /bin/sh -
2 #
3 # Copyright (c) 2010 Apple Inc. All rights reserved.
4 #
5 # @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 #
7 # This file contains Original Code and/or Modifications of Original Code
8 # as defined in and that are subject to the Apple Public Source License
9 # Version 2.0 (the 'License'). You may not use this file except in
10 # compliance with the License. Please obtain a copy of the License at
11 # http://www.opensource.apple.com/apsl/ and read it before using this
12 # file.
13 #
14 # The Original Code and all software distributed under the License are
15 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19 # Please see the License for the specific language governing rights and
20 # limitations under the License.
21 #
22 # @APPLE_OSREFERENCE_LICENSE_HEADER_END@
23 #
24
25 function usage() {
26 echo "Usage: $0 <output>" 1>&2
27 exit 1
28 }
29
30 if [ $# -ne 1 ]; then
31 usage
32 fi
33
34 OUTPUT="$1"
35
36 POSIX_VALUES="198808L 199009L 199209L 199309L 199506L 200112L 200809L"
37
38 {
39 cat <<EOF
40 /* Copyright (c) 2010 Apple Inc. All rights reserved.
41 *
42 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
43 *
44 * This file contains Original Code and/or Modifications of Original Code
45 * as defined in and that are subject to the Apple Public Source License
46 * Version 2.0 (the 'License'). You may not use this file except in
47 * compliance with the License. The rights granted to you under the License
48 * may not be used to create, or enable the creation or redistribution of,
49 * unlawful or unlicensed copies of an Apple operating system, or to
50 * circumvent, violate, or enable the circumvention or violation of, any
51 * terms of an Apple operating system software license agreement.
52 *
53 * Please obtain a copy of the License at
54 * http://www.opensource.apple.com/apsl/ and read it before using this file.
55 *
56 * The Original Code and all software distributed under the License are
57 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
58 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
59 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
60 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
61 * Please see the License for the specific language governing rights and
62 * limitations under the License.
63 *
64 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
65 */
66
67 #ifndef _CDEFS_H_
68 # error "Never use <sys/_posix_availability.h> directly. Use <sys/cdefs.h> instead."
69 #endif
70
71 EOF
72
73 for value in ${POSIX_VALUES} ; do
74 echo "#if !defined(_DARWIN_C_SOURCE) && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= ${value}"
75 echo "#define ___POSIX_C_DEPRECATED_STARTING_${value} __deprecated"
76 echo "#else"
77 echo "#define ___POSIX_C_DEPRECATED_STARTING_${value}"
78 echo "#endif"
79 echo
80 done
81 } > "$OUTPUT"
82