• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/lib/gcc/arm-none-eabi/4.8.1/include-fixed/sys/
1/*  DO NOT EDIT THIS FILE.
2
3    It has been auto-edited by fixincludes from:
4
5	"/scratch/astubbs/arm-eabi-lite/install/opt/codesourcery/arm-none-eabi/usr/include/sys/cdefs.h"
6
7    This had to be done to correct non-standard usages in the
8    original, manufacturer supplied header file.  */
9
10/* libc/sys/linux/sys/cdefs.h - Helper macros for K&R vs. ANSI C compat. */
11
12/* Written 2000 by Werner Almesberger */
13
14/*-
15 * Copyright (c) 1991, 1993
16 *	The Regents of the University of California.  All rights reserved.
17 *
18 * This code is derived from software contributed to Berkeley by
19 * Berkeley Software Design, Inc.
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions
23 * are met:
24 * 1. Redistributions of source code must retain the above copyright
25 *    notice, this list of conditions and the following disclaimer.
26 * 2. Redistributions in binary form must reproduce the above copyright
27 *    notice, this list of conditions and the following disclaimer in the
28 *    documentation and/or other materials provided with the distribution.
29 * 4. Neither the name of the University nor the names of its contributors
30 *    may be used to endorse or promote products derived from this software
31 *    without specific prior written permission.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * SUCH DAMAGE.
44 *
45 *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
46 * $FreeBSD$
47 */
48
49#ifndef	_SYS_CDEFS_H_
50#define	_SYS_CDEFS_H_
51
52#include <sys/features.h>
53#include <stddef.h>
54#include <stdint.h>
55
56#define __PMT(args)	args
57#define __DOTS    	, ...
58#define __THROW
59
60#ifdef __GNUC__
61# define __ASMNAME(cname)  __XSTRING (__USER_LABEL_PREFIX__) cname
62#endif
63
64#define __ptr_t void *
65#define __long_double_t  long double
66
67#define __attribute_malloc__
68#define __attribute_pure__
69#define __attribute_format_strfmon__(a,b)
70#define __flexarr      [0]
71
72#ifndef __BOUNDED_POINTERS__
73# define __bounded      /* nothing */
74# define __unbounded    /* nothing */
75# define __ptrvalue     /* nothing */
76#endif
77
78#if defined(__cplusplus)
79#define	__BEGIN_DECLS	extern "C" {
80#define	__END_DECLS	}
81#else
82#define	__BEGIN_DECLS
83#define	__END_DECLS
84#endif
85
86/*
87 * This code has been put in place to help reduce the addition of
88 * compiler specific defines in FreeBSD code.  It helps to aid in
89 * having a compiler-agnostic source tree.
90 */
91
92#if defined(__GNUC__) || defined(__INTEL_COMPILER)
93
94#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
95#define __GNUCLIKE_ASM 3
96#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
97#else
98#define __GNUCLIKE_ASM 2
99#endif
100#define __GNUCLIKE___TYPEOF 1
101#define __GNUCLIKE___OFFSETOF 1
102#define __GNUCLIKE___SECTION 1
103
104#ifndef __INTEL_COMPILER
105# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
106#endif
107
108#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
109# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
110    && __INTEL_COMPILER < 800
111#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
112# endif
113
114#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
115# define __GNUCLIKE_BUILTIN_VARARGS 1
116# define __GNUCLIKE_BUILTIN_STDARG 1
117# define __GNUCLIKE_BUILTIN_VAALIST 1
118#endif
119
120#if defined(__GNUC__)
121# define __GNUC_VA_LIST_COMPATIBILITY 1
122#endif
123
124/*
125 * Compiler memory barriers, specific to gcc and clang.
126 */
127#if defined(__GNUC__)
128#define	__compiler_membar()	__asm __volatile(" " : : : "memory")
129#endif
130
131#ifndef __INTEL_COMPILER
132# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
133# define __GNUCLIKE_MATH_BUILTIN_RELOPS
134#endif
135
136#define __GNUCLIKE_BUILTIN_MEMCPY 1
137
138/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
139#define __CC_SUPPORTS_INLINE 1
140#define __CC_SUPPORTS___INLINE 1
141#define __CC_SUPPORTS___INLINE__ 1
142
143#define __CC_SUPPORTS___FUNC__ 1
144#define __CC_SUPPORTS_WARNING 1
145
146#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
147
148#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
149
150#endif /* __GNUC__ || __INTEL_COMPILER */
151
152/*
153 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
154 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
155 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
156 * mode -- there must be no spaces between its arguments, and for nested
157 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
158 * concatenate double-quoted strings produced by the __STRING macro, but
159 * this only works with ANSI C.
160 *
161 * __XSTRING is like __STRING, but it expands any macros in its argument
162 * first.  It is only available with ANSI C.
163 */
164#if defined(__STDC__) || defined(__cplusplus)
165#define	__P(protos)	protos		/* full-blown ANSI C */
166#define	__CONCAT1(x,y)	x ## y
167#define	__CONCAT(x,y)	__CONCAT1(x,y)
168#define	__STRING(x)	#x		/* stringify without expanding x */
169#define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */
170
171#define	__const		const		/* define reserved names to standard */
172#define	__signed	signed
173#define	__volatile	volatile
174#if defined(__cplusplus)
175#define	__inline	inline		/* convert to C++ keyword */
176#else
177#if !(defined(__CC_SUPPORTS___INLINE))
178#define	__inline			/* delete GCC keyword */
179#endif /* ! __CC_SUPPORTS___INLINE */
180#endif /* !__cplusplus */
181
182#else	/* !(__STDC__ || __cplusplus) */
183#define	__P(protos)	()		/* traditional C preprocessor */
184#define	__CONCAT(x,y)	x/**/y
185#define	__STRING(x)	"x"
186
187#if !defined(__CC_SUPPORTS___INLINE)
188#define	__const				/* delete pseudo-ANSI C keywords */
189#define	__inline
190#define	__signed
191#define	__volatile
192/*
193 * In non-ANSI C environments, new programs will want ANSI-only C keywords
194 * deleted from the program and old programs will want them left alone.
195 * When using a compiler other than gcc, programs using the ANSI C keywords
196 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
197 * When using "gcc -traditional", we assume that this is the intent; if
198 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
199 */
200#ifndef	NO_ANSI_KEYWORDS
201#define	const				/* delete ANSI C keywords */
202#define	inline
203#define	signed
204#define	volatile
205#endif	/* !NO_ANSI_KEYWORDS */
206#endif	/* !__CC_SUPPORTS___INLINE */
207#endif	/* !(__STDC__ || __cplusplus) */
208
209/*
210 * Compiler-dependent macros to help declare dead (non-returning) and
211 * pure (no side effects) functions, and unused variables.  They are
212 * null except for versions of gcc that are known to support the features
213 * properly (old versions of gcc-2 supported the dead and pure features
214 * in a different (wrong) way).  If we do not provide an implementation
215 * for a given compiler, let the compile fail if it is told to use
216 * a feature that we cannot live without.
217 */
218#ifdef lint
219#define	__dead2
220#define	__pure2
221#define	__unused
222#define	__packed
223#define	__aligned(x)
224#define	__section(x)
225#else
226#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
227#define	__dead2
228#define	__pure2
229#define	__unused
230#endif
231#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
232#define	__dead2		__attribute__((__noreturn__))
233#define	__pure2		__attribute__((__const__))
234#define	__unused
235/* XXX Find out what to do for __packed, __aligned and __section */
236#endif
237#if __GNUC_PREREQ__(2, 7)
238#define	__dead2		__attribute__((__noreturn__))
239#define	__pure2		__attribute__((__const__))
240#define	__unused	__attribute__((__unused__))
241#define	__used		__attribute__((__used__))
242#define	__packed	__attribute__((__packed__))
243#define	__aligned(x)	__attribute__((__aligned__(x)))
244#define	__section(x)	__attribute__((__section__(x)))
245#endif
246#if defined(__INTEL_COMPILER)
247#define __dead2		__attribute__((__noreturn__))
248#define __pure2		__attribute__((__const__))
249#define __unused	__attribute__((__unused__))
250#define __used		__attribute__((__used__))
251#define __packed	__attribute__((__packed__))
252#define __aligned(x)	__attribute__((__aligned__(x)))
253#define __section(x)	__attribute__((__section__(x)))
254#endif
255#endif
256
257#if !__GNUC_PREREQ__(2, 95)
258#define	__alignof(x)	__offsetof(struct { char __a; x __b; }, __b)
259#endif
260
261/*
262 * Keywords added in C11.
263 */
264#if defined(__cplusplus) && __cplusplus >= 201103L
265#define	_Alignas(e)		alignas(e)
266#define	_Alignof(e)		alignof(e)
267#define	_Noreturn		__attribute__((__noreturn__))
268#define	_Static_assert(e, s)	static_assert(e, s)
269/* FIXME: change this to thread_local when clang in base supports it */
270#define	_Thread_local		__thread
271#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
272/* Do nothing.  They are language keywords. */
273#else
274/* Not supported.  Implement them using our versions. */
275#define	_Alignas(x)		__aligned(x)
276#define	_Alignof(x)		__alignof(x)
277#define	_Noreturn		__dead2
278#define	_Thread_local		__thread
279#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus)
280/*  Do nothing: _Static_assert() works as per C11 */
281#elif defined(__COUNTER__)
282#define	_Static_assert(x, y)	__Static_assert(x, __COUNTER__)
283#define	__Static_assert(x, y)	___Static_assert(x, y)
284#define	___Static_assert(x, y)	typedef char __assert_ ## y[(x) ? 1 : -1]
285#else
286#define	_Static_assert(x, y)	struct __hack
287#endif
288#endif
289
290/*
291 * Emulation of C11 _Generic().  Unlike the previously defined C11
292 * keywords, it is not possible to implement this using exactly the same
293 * syntax.  Therefore implement something similar under the name
294 * __generic().  Unlike _Generic(), this macro can only distinguish
295 * between a single type, so it requires nested invocations to
296 * distinguish multiple cases.
297 */
298
299#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
300#define	__generic(expr, t, yes, no)					\
301	_Generic(expr, t: yes, default: no)
302#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
303#define	__generic(expr, t, yes, no)					\
304	__builtin_choose_expr(						\
305	    __builtin_types_compatible_p(__typeof(expr), t), yes, no)
306#endif
307
308#if __GNUC_PREREQ__(2, 96)
309#define	__malloc_like	__attribute__((__malloc__))
310#define	__pure		__attribute__((__pure__))
311#else
312#define	__malloc_like
313#define	__pure
314#endif
315
316#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
317#define	__always_inline	__attribute__((__always_inline__))
318#else
319#define	__always_inline
320#endif
321
322#if __GNUC_PREREQ__(3, 1)
323#define	__noinline	__attribute__ ((__noinline__))
324#else
325#define	__noinline
326#endif
327
328#if __GNUC_PREREQ__(3, 3)
329#define __nonnull(x)	__attribute__((__nonnull__(x)))
330#else
331#define __nonnull(x)
332#endif
333
334#if __GNUC_PREREQ__(3, 4)
335#define	__fastcall	__attribute__((__fastcall__))
336#else
337#define	__fastcall
338#endif
339
340#if __GNUC_PREREQ__(4, 1)
341#define	__returns_twice	__attribute__((__returns_twice__))
342#else
343#define	__returns_twice
344#endif
345
346/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
347#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
348#define	__func__	NULL
349#endif
350
351/*
352 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
353 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
354 * a way to define the `restrict' type qualifier without disturbing older
355 * software that is unaware of C99 keywords.
356 */
357#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
358#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
359#define	__restrict
360#else
361#define	__restrict	restrict
362#endif
363#endif
364
365/*
366 * GNU C version 2.96 adds explicit branch prediction so that
367 * the CPU back-end can hint the processor and also so that
368 * code blocks can be reordered such that the predicted path
369 * sees a more linear flow, thus improving cache behavior, etc.
370 *
371 * The following two macros provide us with a way to utilize this
372 * compiler feature.  Use __predict_true() if you expect the expression
373 * to evaluate to true, and __predict_false() if you expect the
374 * expression to evaluate to false.
375 *
376 * A few notes about usage:
377 *
378 *	* Generally, __predict_false() error condition checks (unless
379 *	  you have some _strong_ reason to do otherwise, in which case
380 *	  document it), and/or __predict_true() `no-error' condition
381 *	  checks, assuming you want to optimize for the no-error case.
382 *
383 *	* Other than that, if you don't know the likelihood of a test
384 *	  succeeding from empirical or other `hard' evidence, don't
385 *	  make predictions.
386 *
387 *	* These are meant to be used in places that are run `a lot'.
388 *	  It is wasteful to make predictions in code that is run
389 *	  seldomly (e.g. at subsystem initialization time) as the
390 *	  basic block reordering that this affects can often generate
391 *	  larger code.
392 */
393#if __GNUC_PREREQ__(2, 96)
394#define __predict_true(exp)     __builtin_expect((exp), 1)
395#define __predict_false(exp)    __builtin_expect((exp), 0)
396#else
397#define __predict_true(exp)     (exp)
398#define __predict_false(exp)    (exp)
399#endif
400
401#if __GNUC_PREREQ__(4, 2)
402#define	__hidden	__attribute__((__visibility__("hidden")))
403#define	__exported	__attribute__((__visibility__("default")))
404#else
405#define	__hidden
406#define	__exported
407#endif
408
409#define __offsetof(type, field)	offsetof(type, field)
410#define	__rangeof(type, start, end) \
411	(__offsetof(type, end) - __offsetof(type, start))
412
413/*
414 * Given the pointer x to the member m of the struct s, return
415 * a pointer to the containing structure.  When using GCC, we first
416 * assign pointer x to a local variable, to check that its type is
417 * compatible with member m.
418 */
419#if __GNUC_PREREQ__(3, 1)
420#define	__containerof(x, s, m) ({					\
421	const volatile __typeof__(((s *)0)->m) *__x = (x);		\
422	__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
423})
424#else
425#define	__containerof(x, s, m)						\
426	__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
427#endif
428
429/*
430 * Compiler-dependent macros to declare that functions take printf-like
431 * or scanf-like arguments.  They are null except for versions of gcc
432 * that are known to support the features properly (old versions of gcc-2
433 * didn't permit keeping the keywords out of the application namespace).
434 */
435#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
436#define	__printflike(fmtarg, firstvararg)
437#define	__scanflike(fmtarg, firstvararg)
438#define	__format_arg(fmtarg)
439#define	__strfmonlike(fmtarg, firstvararg)
440#define	__strftimelike(fmtarg, firstvararg)
441#else
442#define	__printflike(fmtarg, firstvararg) \
443	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
444#define	__scanflike(fmtarg, firstvararg) \
445	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
446#define	__format_arg(fmtarg)	__attribute__((__format_arg__ (fmtarg)))
447#define	__strfmonlike(fmtarg, firstvararg) \
448	    __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
449#define	__strftimelike(fmtarg, firstvararg) \
450	    __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
451#endif
452
453/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
454#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
455    defined(__GNUC__) && !defined(__INTEL_COMPILER)
456#define	__printf0like(fmtarg, firstvararg) \
457	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
458#else
459#define	__printf0like(fmtarg, firstvararg)
460#endif
461
462#if defined(__GNUC__) || defined(__INTEL_COMPILER)
463#ifndef __INTEL_COMPILER
464#define	__strong_reference(sym,aliassym)	\
465	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
466#endif
467#ifdef __ELF__
468#ifdef __STDC__
469#define	__weak_reference(sym,alias)	\
470	__asm__(".weak " #alias);	\
471	__asm__(".equ "  #alias ", " #sym)
472#define	__warn_references(sym,msg)	\
473	__asm__(".section .gnu.warning." #sym);	\
474	__asm__(".asciz \"" msg "\"");	\
475	__asm__(".previous")
476#define	__sym_compat(sym,impl,verid)	\
477	__asm__(".symver " #impl ", " #sym "@" #verid)
478#define	__sym_default(sym,impl,verid)	\
479	__asm__(".symver " #impl ", " #sym "@@" #verid)
480#else
481#define	__weak_reference(sym,alias)	\
482	__asm__(".weak alias");		\
483	__asm__(".equ alias, sym")
484#define	__warn_references(sym,msg)	\
485	__asm__(".section .gnu.warning.sym"); \
486	__asm__(".asciz \"msg\"");	\
487	__asm__(".previous")
488#define	__sym_compat(sym,impl,verid)	\
489	__asm__(".symver impl, sym@verid")
490#define	__sym_default(impl,sym,verid)	\
491	__asm__(".symver impl, sym@@verid")
492#endif	/* __STDC__ */
493#else	/* !__ELF__ */
494#ifdef __STDC__
495#define	__weak_reference(sym,alias)	\
496	__asm__(".stabs \"_" #alias "\",11,0,0,0");	\
497	__asm__(".stabs \"_" #sym "\",1,0,0,0")
498#define	__warn_references(sym,msg)	\
499	__asm__(".stabs \"" msg "\",30,0,0,0");		\
500	__asm__(".stabs \"_" #sym "\",1,0,0,0")
501#else
502#define	__weak_reference(sym,alias)	\
503	__asm__(".stabs \"_/**/alias\",11,0,0,0");	\
504	__asm__(".stabs \"_/**/sym\",1,0,0,0")
505#define	__warn_references(sym,msg)	\
506	__asm__(".stabs msg,30,0,0,0");			\
507	__asm__(".stabs \"_/**/sym\",1,0,0,0")
508#endif	/* __STDC__ */
509#endif	/* __ELF__ */
510#endif	/* __GNUC__ || __INTEL_COMPILER */
511
512#ifndef	__FBSDID
513#define	__FBSDID(s)	struct __hack
514#endif
515
516#ifndef	__RCSID
517#define	__RCSID(s)	struct __hack
518#endif
519
520#ifndef	__RCSID_SOURCE
521#define	__RCSID_SOURCE(s)	struct __hack
522#endif
523
524#ifndef	__SCCSID
525#define	__SCCSID(s)	struct __hack
526#endif
527
528#ifndef	__COPYRIGHT
529#define	__COPYRIGHT(s)	struct __hack
530#endif
531
532#ifndef	__DECONST
533#define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
534#endif
535
536#ifndef	__DEVOLATILE
537#define	__DEVOLATILE(type, var)	((type)(uintptr_t)(volatile void *)(var))
538#endif
539
540#ifndef	__DEQUALIFY
541#define	__DEQUALIFY(type, var)	((type)(uintptr_t)(const volatile void *)(var))
542#endif
543
544/*-
545 * The following definitions are an extension of the behavior originally
546 * implemented in <sys/_posix.h>, but with a different level of granularity.
547 * POSIX.1 requires that the macros we test be defined before any standard
548 * header file is included.
549 *
550 * Here's a quick run-down of the versions:
551 *  defined(_POSIX_SOURCE)		1003.1-1988
552 *  _POSIX_C_SOURCE == 1		1003.1-1990
553 *  _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option
554 *  _POSIX_C_SOURCE == 199309		1003.1b-1993
555 *  _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995,
556 *					and the omnibus ISO/IEC 9945-1: 1996
557 *  _POSIX_C_SOURCE == 200112		1003.1-2001
558 *  _POSIX_C_SOURCE == 200809		1003.1-2008
559 *
560 * In addition, the X/Open Portability Guide, which is now the Single UNIX
561 * Specification, defines a feature-test macro which indicates the version of
562 * that specification, and which subsumes _POSIX_C_SOURCE.
563 *
564 * Our macros begin with two underscores to avoid namespace screwage.
565 */
566
567/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
568#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
569#undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */
570#define	_POSIX_C_SOURCE		199009
571#endif
572
573/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
574#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
575#undef _POSIX_C_SOURCE
576#define	_POSIX_C_SOURCE		199209
577#endif
578
579/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
580#ifdef _XOPEN_SOURCE
581#if _XOPEN_SOURCE - 0 >= 700
582#define	__XSI_VISIBLE		700
583#undef _POSIX_C_SOURCE
584#define	_POSIX_C_SOURCE		200809
585#elif _XOPEN_SOURCE - 0 >= 600
586#define	__XSI_VISIBLE		600
587#undef _POSIX_C_SOURCE
588#define	_POSIX_C_SOURCE		200112
589#elif _XOPEN_SOURCE - 0 >= 500
590#define	__XSI_VISIBLE		500
591#undef _POSIX_C_SOURCE
592#define	_POSIX_C_SOURCE		199506
593#endif
594#endif
595
596/*
597 * Deal with all versions of POSIX.  The ordering relative to the tests above is
598 * important.
599 */
600#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
601#define	_POSIX_C_SOURCE		198808
602#endif
603#ifdef _POSIX_C_SOURCE
604#if _POSIX_C_SOURCE >= 200809
605#define	__POSIX_VISIBLE		200809
606#define	__ISO_C_VISIBLE		1999
607#elif _POSIX_C_SOURCE >= 200112
608#define	__POSIX_VISIBLE		200112
609#define	__ISO_C_VISIBLE		1999
610#elif _POSIX_C_SOURCE >= 199506
611#define	__POSIX_VISIBLE		199506
612#define	__ISO_C_VISIBLE		1990
613#elif _POSIX_C_SOURCE >= 199309
614#define	__POSIX_VISIBLE		199309
615#define	__ISO_C_VISIBLE		1990
616#elif _POSIX_C_SOURCE >= 199209
617#define	__POSIX_VISIBLE		199209
618#define	__ISO_C_VISIBLE		1990
619#elif _POSIX_C_SOURCE >= 199009
620#define	__POSIX_VISIBLE		199009
621#define	__ISO_C_VISIBLE		1990
622#else
623#define	__POSIX_VISIBLE		198808
624#define	__ISO_C_VISIBLE		0
625#endif /* _POSIX_C_SOURCE */
626#else
627/*-
628 * Deal with _ANSI_SOURCE:
629 * If it is defined, and no other compilation environment is explicitly
630 * requested, then define our internal feature-test macros to zero.  This
631 * makes no difference to the preprocessor (undefined symbols in preprocessing
632 * expressions are defined to have value zero), but makes it more convenient for
633 * a test program to print out the values.
634 *
635 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
636 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
637 * environment (and in fact we will never get here).
638 */
639#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
640#define	__POSIX_VISIBLE		0
641#define	__XSI_VISIBLE		0
642#define	__BSD_VISIBLE		0
643#define	__ISO_C_VISIBLE		1990
644#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
645#define	__POSIX_VISIBLE		0
646#define	__XSI_VISIBLE		0
647#define	__BSD_VISIBLE		0
648#define	__ISO_C_VISIBLE		1999
649#elif defined(_C11_SOURCE)	/* Localism to specify strict C11 env. */
650#define	__POSIX_VISIBLE		0
651#define	__XSI_VISIBLE		0
652#define	__BSD_VISIBLE		0
653#define	__ISO_C_VISIBLE		2011
654#else				/* Default environment: show everything. */
655#define	__POSIX_VISIBLE		200809
656#define	__XSI_VISIBLE		700
657#define	__BSD_VISIBLE		1
658#define	__ISO_C_VISIBLE		2011
659#endif
660#endif
661
662#ifndef	__has_extension
663#define	__has_extension  __has_feature
664#endif
665#ifndef	__has_feature
666#define	__has_feature(x) 0
667#endif
668#ifndef	__has_include
669#define	__has_include(x) 0
670#endif
671#ifndef	__has_builtin
672#define	__has_builtin(x) 0
673#endif
674
675#endif /* !_SYS_CDEFS_H_ */
676