• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Xfuncproto.h.  Generated from Xfuncproto.h.in by configure.  */
2 /*
3  *
4 Copyright 1989, 1991, 1998  The Open Group
5 
6 Permission to use, copy, modify, distribute, and sell this software and its
7 documentation for any purpose is hereby granted without fee, provided that
8 the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
10 documentation.
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 Except as contained in this notice, the name of The Open Group shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in 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__)
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 /* requires xproto >= 7.0.9 */
102 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
103 # define _X_LIKELY(x)   __builtin_expect(!!(x), 1)
104 # define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
105 #else /* not gcc >= 3.3 */
106 # define _X_LIKELY(x)   (x)
107 # define _X_UNLIKELY(x) (x)
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 - since this uses either gcc or C99 variable
133    argument macros, must be only used inside #ifdef _X_NONNULL guards, as
134    many legacy X clients are compiled in C89 mode still. */
135 #if defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
136 #define _X_NONNULL(args...)  __attribute__((nonnull(args)))
137 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
138 #define _X_NONNULL(...)  /* */
139 #endif
140 
141 /* requires xproto >= 7.0.22 */
142 #if defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
143 #define _X_UNUSED  __attribute__((__unused__))
144 #else
145 #define _X_UNUSED  /* */
146 #endif
147 
148 /* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
149 /* requires xproto >= 7.0.9
150    (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
151 #if defined(inline) /* assume autoconf set it correctly */ || \
152    (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
153    (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
154 # define _X_INLINE inline
155 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
156 # define _X_INLINE __inline__
157 #else
158 # define _X_INLINE
159 #endif
160 
161 /* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
162 /* requires xproto >= 7.0.21 */
163 #ifndef _X_RESTRICT_KYWD
164 # if defined(restrict) /* assume autoconf set it correctly */ || \
165    (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
166 #  define _X_RESTRICT_KYWD  restrict
167 # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
168 #  define _X_RESTRICT_KYWD __restrict__
169 # else
170 #  define _X_RESTRICT_KYWD
171 # endif
172 #endif
173 
174 #endif /* _XFUNCPROTO_H_ */
175