Debian Codegraph @

nx-X11/include/Xfuncproto.h

raw
1 /*
2 *
3 Copyright 1989, 1991, 1998 The Open Group
4
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
24 *
25 */
26
27 /* Definitions to make function prototypes manageable */
28
29 #ifndef _XFUNCPROTO_H_
30 #define _XFUNCPROTO_H_
31
32 #ifndef NeedFunctionPrototypes
33 #define NeedFunctionPrototypes 1
34 #endif /* NeedFunctionPrototypes */
35
36 #ifndef NeedVarargsPrototypes
37 #define NeedVarargsPrototypes 1
38 #endif /* NeedVarargsPrototypes */
39
40 #if NeedFunctionPrototypes
41
42 #ifndef NeedNestedPrototypes
43 #define NeedNestedPrototypes 1
44 #endif /* NeedNestedPrototypes */
45
46 #ifndef _Xconst
47 #define _Xconst const
48 #endif /* _Xconst */
49
50 #ifndef NeedWidePrototypes
51 #ifdef NARROWPROTO
52 #define NeedWidePrototypes 0
53 #else
54 #define NeedWidePrototypes 1 /* default to make interropt. easier */
55 #endif
56 #endif /* NeedWidePrototypes */
57
58 #endif /* NeedFunctionPrototypes */
59
60 #ifndef _XFUNCPROTOBEGIN
61 #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
62 #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
63 #define _XFUNCPROTOEND }
64 #else
65 #define _XFUNCPROTOBEGIN
66 #define _XFUNCPROTOEND
67 #endif
68 #endif /* _XFUNCPROTOBEGIN */
69
70 /* Added in X11R6.9, so available in any version of modular xproto */
71 #if defined(__GNUC__) && (__GNUC__ >= 4)
72 # define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
73 #else
74 # define _X_SENTINEL(x)
75 #endif /* GNUC >= 4 */
76
77 /* Added in X11R6.9, so available in any version of modular xproto */
78 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(__MINGW32__)
79 # define _X_EXPORT __attribute__((visibility("default")))
80 # define _X_HIDDEN __attribute__((visibility("hidden")))
81 # define _X_INTERNAL __attribute__((visibility("internal")))
82 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
83 # define _X_EXPORT __global
84 # define _X_HIDDEN __hidden
85 # define _X_INTERNAL __hidden
86 #else /* not gcc >= 4 and not Sun Studio >= 8 */
87 # define _X_EXPORT
88 # define _X_HIDDEN
89 # define _X_INTERNAL
90 #endif /* GNUC >= 4 */
91
92 /* Branch prediction hints for individual conditionals */
93 /* requires xproto >= 7.0.9 */
94 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
95 # define _X_LIKELY(x) __builtin_expect(!!(x), 1)
96 # define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
97 #else /* not gcc >= 3.3 */
98 # define _X_LIKELY(x) (x)
99 # define _X_UNLIKELY(x) (x)
100 #endif
101
102 /* Bulk branch prediction hints via marking error path functions as "cold" */
103 /* requires xproto >= 7.0.25 */
104 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */
105 # define _X_COLD __attribute__((__cold__))
106 #else
107 # define _X_COLD /* nothing */
108 #endif
109
110 /* Added in X11R6.9, so available in any version of modular xproto */
111 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
112 # define _X_DEPRECATED __attribute__((deprecated))
113 #else /* not gcc >= 3.1 */
114 # define _X_DEPRECATED
115 #endif
116
117 /* requires xproto >= 7.0.17 */
118 #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
119 || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
120 # define _X_NORETURN __attribute((noreturn))
121 #else
122 # define _X_NORETURN
123 #endif /* GNUC */
124
125 /* Added in X11R6.9, so available in any version of modular xproto */
126 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
127 # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
128 #else /* not gcc >= 2.3 */
129 # define _X_ATTRIBUTE_PRINTF(x,y)
130 #endif
131
132 /* requires xproto >= 7.0.22 */
133 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
134 #define _X_UNUSED __attribute__((__unused__))
135 #else
136 #define _X_UNUSED /* */
137 #endif
138
139 /* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
140 /* requires xproto >= 7.0.9
141 (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
142 #if defined(inline) /* assume autoconf set it correctly */ || \
143 (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
144 (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
145 # define _X_INLINE inline
146 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
147 # define _X_INLINE __inline__
148 #else
149 # define _X_INLINE
150 #endif
151
152 /* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
153 /* requires xproto >= 7.0.21 */
154 #ifndef _X_RESTRICT_KYWD
155 # if defined(restrict) /* assume autoconf set it correctly */ || \
156 (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
157 && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
158 # define _X_RESTRICT_KYWD restrict
159 # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
160 # define _X_RESTRICT_KYWD __restrict__
161 # else
162 # define _X_RESTRICT_KYWD
163 # endif
164 #endif
165
166 #endif /* _XFUNCPROTO_H_ */