Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/X11/Xfuncproto.h
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 /* Function prototype configuration (see configure for more info) */ 51 #if !defined(NARROWPROTO) && \ 52 (defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) 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 /* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute */ 80 #ifndef __has_attribute 81 # define __has_attribute(x) 0 /* Compatibility with older compilers. */ 82 #endif 83 #ifndef __has_feature 84 # define __has_feature(x) 0 /* Compatibility with older compilers. */ 85 #endif 86 #ifndef __has_extension 87 # define __has_extension(x) 0 /* Compatibility with older compilers. */ 88 #endif 89 #ifndef __has_c_attribute 90 # define __has_c_attribute(x) 0 /* Compatibility with pre-C23 compilers. */ 91 #endif 92 93 /* Added in X11R6.9, so available in any version of modular xproto */ 94 #if __has_attribute(__sentinel__) || (defined(__GNUC__) && (__GNUC__ >= 4)) 95 # define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) 96 #else 97 # define _X_SENTINEL(x) 98 #endif /* GNUC >= 4 */ 99 100 /* Added in X11R6.9, so available in any version of modular xproto */ 101 #if (__has_attribute(visibility) || (defined(__GNUC__) && (__GNUC__ >= 4))) \ 102 && !defined(__CYGWIN__) && !defined(__MINGW32__) 103 # define _X_EXPORT __attribute__((visibility("default"))) 104 # define _X_HIDDEN __attribute__((visibility("hidden"))) 105 # define _X_INTERNAL __attribute__((visibility("internal"))) 106 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) 107 # define _X_EXPORT __global 108 # define _X_HIDDEN __hidden 109 # define _X_INTERNAL __hidden 110 #else /* not gcc >= 4 and not Sun Studio >= 8 */ 111 # define _X_EXPORT 112 # define _X_HIDDEN 113 # define _X_INTERNAL 114 #endif /* GNUC >= 4 */ 115 116 /* Branch prediction hints for individual conditionals */ 117 /* requires xproto >= 7.0.9 */ 118 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) 119 # define _X_LIKELY(x) __builtin_expect(!!(x), 1) 120 # define _X_UNLIKELY(x) __builtin_expect(!!(x), 0) 121 #else /* not gcc >= 3.3 */ 122 # define _X_LIKELY(x) (x) 123 # define _X_UNLIKELY(x) (x) 124 #endif 125 126 /* Bulk branch prediction hints via marking error path functions as "cold" */ 127 /* requires xproto >= 7.0.25 */ 128 #if __has_attribute(__cold__) || \ 129 (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) /* 4.3+ */ 130 # define _X_COLD __attribute__((__cold__)) 131 #else 132 # define _X_COLD /* nothing */ 133 #endif 134 135 /* Added in X11R6.9, so available in any version of modular xproto */ 136 #if __has_attribute(deprecated) \ 137 || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)) \ 138 || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5130)) 139 # define _X_DEPRECATED __attribute__((deprecated)) 140 #else /* not gcc >= 3.1 */ 141 # define _X_DEPRECATED 142 #endif 143 144 /* requires xproto >= 7.0.30 */ 145 #if __has_extension(attribute_deprecated_with_message) || \ 146 (defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))) 147 # define _X_DEPRECATED_MSG(_msg) __attribute__((deprecated(_msg))) 148 #else 149 # define _X_DEPRECATED_MSG(_msg) _X_DEPRECATED 150 #endif 151 152 /* requires xproto >= 7.0.17 */ 153 #if __has_attribute(noreturn) \ 154 || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \ 155 || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) 156 # define _X_NORETURN __attribute((noreturn)) 157 #else 158 # define _X_NORETURN 159 #endif /* GNUC */ 160 161 /* Added in X11R6.9, so available in any version of modular xproto */ 162 #if __has_attribute(__format__) \ 163 || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) 164 # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) 165 #else /* not gcc >= 2.3 */ 166 # define _X_ATTRIBUTE_PRINTF(x,y) 167 #endif 168 169 /* requires xproto >= 7.0.22 */ 170 #if __has_attribute(__unused__) \ 171 || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) 172 #define _X_UNUSED __attribute__((__unused__)) 173 #else 174 #define _X_UNUSED /* */ 175 #endif 176 177 /* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */ 178 /* requires xproto >= 7.0.9 179 (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */ 180 #if defined(inline) /* assume autoconf set it correctly */ || \ 181 (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \ 182 (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) 183 # define _X_INLINE inline 184 #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ 185 # define _X_INLINE __inline__ 186 #else 187 # define _X_INLINE 188 #endif 189 190 /* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */ 191 /* requires xproto >= 7.0.21 */ 192 #ifndef _X_RESTRICT_KYWD 193 # if defined(restrict) /* assume autoconf set it correctly */ || \ 194 (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \ 195 && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */ 196 # define _X_RESTRICT_KYWD restrict 197 # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ 198 # define _X_RESTRICT_KYWD __restrict__ 199 # else 200 # define _X_RESTRICT_KYWD 201 # endif 202 #endif 203 204 /* requires xproto >= 7.0.30 */ 205 #if __has_attribute(no_sanitize_thread) 206 # define _X_NOTSAN __attribute__((no_sanitize_thread)) 207 #else 208 # define _X_NOTSAN 209 #endif 210 211 /* Mark a char array/pointer as not containing a NUL-terminated string */ 212 /* requires xproto >= 7.0.33 */ 213 #if __has_attribute(nonstring) 214 # define _X_NONSTRING __attribute__((nonstring)) 215 #else 216 # define _X_NONSTRING 217 #endif 218 219 /* Mark a fallthrough in a switch statement as intentional 220 Handles C23 compilers, as well as gcc >= 7 and clang >= 12 221 For older compilers/linters, pair with a fallthrough comment. */ 222 /* requires xproto >= 7.0.34 */ 223 #if __has_c_attribute(fallthrough) 224 #define _X_FALLTHROUGH [[fallthrough]] 225 #elif __has_attribute(fallthrough) 226 #define _X_FALLTHROUGH __attribute__((fallthrough)) 227 #else 228 #define _X_FALLTHROUGH (void)0 229 #endif 230 231 #endif /* _XFUNCPROTO_H_ */