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