os/ossrv/genericopenlibs/openenvcore/include/sys/cdefs.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 *
sl@0
     3
 * Copyright (c) 1991, 1993
sl@0
     4
 *	The Regents of the University of California.  All rights reserved.
sl@0
     5
 *
sl@0
     6
 * This code is derived from software contributed to Berkeley by
sl@0
     7
 * Berkeley Software Design, Inc.
sl@0
     8
 *
sl@0
     9
 * Redistribution and use in source and binary forms, with or without
sl@0
    10
 * modification, are permitted provided that the following conditions
sl@0
    11
 * are met:
sl@0
    12
 * 1. Redistributions of source code must retain the above copyright
sl@0
    13
 *    notice, this list of conditions and the following disclaimer.
sl@0
    14
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    15
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    16
 *    documentation and/or other materials provided with the distribution.
sl@0
    17
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    18
 *    may be used to endorse or promote products derived from this software
sl@0
    19
 *    without specific prior written permission.
sl@0
    20
 *
sl@0
    21
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    22
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    23
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    24
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    25
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    26
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    27
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    28
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    29
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    30
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    31
 * SUCH DAMAGE.
sl@0
    32
* © Portions Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    33
 *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
sl@0
    34
 * $FreeBSD: src/sys/sys/cdefs.h,v 1.88.2.1 2005/10/09 07:48:48 netchild Exp $
sl@0
    35
 */
sl@0
    36
sl@0
    37
#ifndef	_SYS_CDEFS_H_
sl@0
    38
#define	_SYS_CDEFS_H_
sl@0
    39
sl@0
    40
#ifdef __SYMBIAN32__
sl@0
    41
#include <_ansi.h>
sl@0
    42
#endif
sl@0
    43
sl@0
    44
#if defined(__cplusplus)
sl@0
    45
#define	__BEGIN_DECLS	extern "C" {
sl@0
    46
#define	__END_DECLS	}
sl@0
    47
#else
sl@0
    48
#define	__BEGIN_DECLS
sl@0
    49
#define	__END_DECLS
sl@0
    50
#endif
sl@0
    51
sl@0
    52
/*
sl@0
    53
 * This code has been put in place to help reduce the addition of
sl@0
    54
 * compiler specific defines in FreeBSD code.  It helps to aid in
sl@0
    55
 * having a compiler-agnostic source tree.
sl@0
    56
 */
sl@0
    57
sl@0
    58
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
sl@0
    59
sl@0
    60
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
sl@0
    61
#define __GNUCLIKE_ASM 3
sl@0
    62
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
sl@0
    63
#else
sl@0
    64
#define __GNUCLIKE_ASM 2
sl@0
    65
#endif
sl@0
    66
#define __GNUCLIKE___TYPEOF 1
sl@0
    67
#define __GNUCLIKE___OFFSETOF 1
sl@0
    68
#define __GNUCLIKE___SECTION 1
sl@0
    69
sl@0
    70
#define __GNUCLIKE_ATTRIBUTE_MODE_DI 1
sl@0
    71
sl@0
    72
#ifndef __INTEL_COMPILER
sl@0
    73
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
sl@0
    74
#endif
sl@0
    75
sl@0
    76
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
sl@0
    77
# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
sl@0
    78
    && __INTEL_COMPILER < 800
sl@0
    79
#  undef __GNUCLIKE_BUILTIN_CONSTANT_P
sl@0
    80
# endif
sl@0
    81
sl@0
    82
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
sl@0
    83
# define __GNUCLIKE_BUILTIN_VARARGS 1
sl@0
    84
# define __GNUCLIKE_BUILTIN_STDARG 1
sl@0
    85
# define __GNUCLIKE_BUILTIN_VAALIST 1
sl@0
    86
#endif
sl@0
    87
sl@0
    88
#if defined(__GNUC__)
sl@0
    89
# define __GNUC_VA_LIST_COMPATIBILITY 1
sl@0
    90
#endif
sl@0
    91
sl@0
    92
#ifndef __INTEL_COMPILER
sl@0
    93
# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
sl@0
    94
# define __GNUCLIKE_MATH_BUILTIN_RELOPS
sl@0
    95
#endif
sl@0
    96
sl@0
    97
#define __GNUCLIKE_BUILTIN_MEMCPY 1
sl@0
    98
sl@0
    99
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
sl@0
   100
#define __CC_SUPPORTS_INLINE 1
sl@0
   101
#define __CC_SUPPORTS___INLINE 1
sl@0
   102
#define __CC_SUPPORTS___INLINE__ 1
sl@0
   103
sl@0
   104
#define __CC_SUPPORTS___FUNC__ 1
sl@0
   105
#define __CC_SUPPORTS_WARNING 1
sl@0
   106
sl@0
   107
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
sl@0
   108
sl@0
   109
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
sl@0
   110
sl@0
   111
/* XXX: sys/dev/mpt/mpilib/mpi_type.h uses it, someone should review it */
sl@0
   112
#define __CC_INT_IS_32BIT 1
sl@0
   113
sl@0
   114
#endif /* __GNUC__ || __INTEL_COMPILER */
sl@0
   115
sl@0
   116
/*
sl@0
   117
 * Macro to test if we're using a specific version of gcc or later.
sl@0
   118
 */
sl@0
   119
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
sl@0
   120
#define	__GNUC_PREREQ__(ma, mi)	\
sl@0
   121
	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
sl@0
   122
#else
sl@0
   123
#define	__GNUC_PREREQ__(ma, mi)	0
sl@0
   124
#endif
sl@0
   125
sl@0
   126
/*
sl@0
   127
 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
sl@0
   128
 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
sl@0
   129
 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
sl@0
   130
 * mode -- there must be no spaces between its arguments, and for nested
sl@0
   131
 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
sl@0
   132
 * concatenate double-quoted strings produced by the __STRING macro, but
sl@0
   133
 * this only works with ANSI C.
sl@0
   134
 *
sl@0
   135
 * __XSTRING is like __STRING, but it expands any macros in its argument
sl@0
   136
 * first.  It is only available with ANSI C.
sl@0
   137
 */
sl@0
   138
#if defined(__STDC__) || defined(__cplusplus)
sl@0
   139
#define	__P(protos)	protos		/* full-blown ANSI C */
sl@0
   140
#define	__CONCAT1(x,y)	x ## y
sl@0
   141
#define	__CONCAT(x,y)	__CONCAT1(x,y)
sl@0
   142
#define	__STRING(x)	#x		/* stringify without expanding x */
sl@0
   143
#define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */
sl@0
   144
sl@0
   145
#define	__const		const		/* define reserved names to standard */
sl@0
   146
#define	__signed	signed
sl@0
   147
#define	__volatile	volatile
sl@0
   148
#if defined(__cplusplus)
sl@0
   149
#define	__inline	inline		/* convert to C++ keyword */
sl@0
   150
#else
sl@0
   151
#if !(defined(__CC_SUPPORTS___INLINE))
sl@0
   152
#define	__inline			/* delete GCC keyword */
sl@0
   153
#endif /* ! __CC_SUPPORTS___INLINE */
sl@0
   154
#endif /* !__cplusplus */
sl@0
   155
sl@0
   156
#else	/* !(__STDC__ || __cplusplus) */
sl@0
   157
#define	__P(protos)	()		/* traditional C preprocessor */
sl@0
   158
#define	__CONCAT(x,y)	x/**/y
sl@0
   159
#define	__STRING(x)	"x"
sl@0
   160
sl@0
   161
#if !defined(__CC_SUPPORTS___INLINE)
sl@0
   162
#define	__const				/* delete pseudo-ANSI C keywords */
sl@0
   163
#define	__inline
sl@0
   164
#define	__signed
sl@0
   165
#define	__volatile
sl@0
   166
/*
sl@0
   167
 * In non-ANSI C environments, new programs will want ANSI-only C keywords
sl@0
   168
 * deleted from the program and old programs will want them left alone.
sl@0
   169
 * When using a compiler other than gcc, programs using the ANSI C keywords
sl@0
   170
 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
sl@0
   171
 * When using "gcc -traditional", we assume that this is the intent; if
sl@0
   172
 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
sl@0
   173
 */
sl@0
   174
#ifndef	NO_ANSI_KEYWORDS
sl@0
   175
#define	const				/* delete ANSI C keywords */
sl@0
   176
#define	inline
sl@0
   177
#define	signed
sl@0
   178
#define	volatile
sl@0
   179
#endif	/* !NO_ANSI_KEYWORDS */
sl@0
   180
#endif	/* !__CC_SUPPORTS___INLINE */
sl@0
   181
#endif	/* !(__STDC__ || __cplusplus) */
sl@0
   182
sl@0
   183
/*
sl@0
   184
 * Compiler-dependent macros to help declare dead (non-returning) and
sl@0
   185
 * pure (no side effects) functions, and unused variables.  They are
sl@0
   186
 * null except for versions of gcc that are known to support the features
sl@0
   187
 * properly (old versions of gcc-2 supported the dead and pure features
sl@0
   188
 * in a different (wrong) way).  If we do not provide an implementation
sl@0
   189
 * for a given compiler, let the compile fail if it is told to use
sl@0
   190
 * a feature that we cannot live without.
sl@0
   191
 */
sl@0
   192
#ifdef lint
sl@0
   193
#define	__dead2
sl@0
   194
#define	__pure2
sl@0
   195
#define	__unused
sl@0
   196
#define	__packed
sl@0
   197
#define	__aligned(x)
sl@0
   198
#define	__section(x)
sl@0
   199
#else
sl@0
   200
#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
sl@0
   201
#define	__dead2
sl@0
   202
#define	__pure2
sl@0
   203
#define	__unused
sl@0
   204
#endif
sl@0
   205
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
sl@0
   206
#define	__dead2		__attribute__((__noreturn__))
sl@0
   207
#define	__pure2		__attribute__((__const__))
sl@0
   208
#define	__unused
sl@0
   209
/* XXX Find out what to do for __packed, __aligned and __section */
sl@0
   210
#endif
sl@0
   211
#if __GNUC_PREREQ__(2, 7)
sl@0
   212
#define	__dead2		__attribute__((__noreturn__))
sl@0
   213
#define	__pure2		__attribute__((__const__))
sl@0
   214
#define	__unused	__attribute__((__unused__))
sl@0
   215
#define	__used		__attribute__((__used__))
sl@0
   216
#define	__packed	__attribute__((__packed__))
sl@0
   217
#define	__aligned(x)	__attribute__((__aligned__(x)))
sl@0
   218
#define	__section(x)	__attribute__((__section__(x)))
sl@0
   219
#endif
sl@0
   220
#if defined(__INTEL_COMPILER)
sl@0
   221
#define __dead2		__attribute__((__noreturn__))
sl@0
   222
#define __pure2		__attribute__((__const__))
sl@0
   223
#define __unused	__attribute__((__unused__))
sl@0
   224
#define __used		__attribute__((__used__))
sl@0
   225
#define __packed	__attribute__((__packed__))
sl@0
   226
#define __aligned(x)	__attribute__((__aligned__(x)))
sl@0
   227
#define __section(x)	__attribute__((__section__(x)))
sl@0
   228
#endif
sl@0
   229
#endif
sl@0
   230
sl@0
   231
#if __GNUC_PREREQ__(2, 96)
sl@0
   232
#define	__pure		__attribute__((__pure__))
sl@0
   233
#else
sl@0
   234
#define	__pure
sl@0
   235
#endif
sl@0
   236
sl@0
   237
#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
sl@0
   238
#define	__always_inline	__attribute__((__always_inline__))
sl@0
   239
#else
sl@0
   240
#define	__always_inline
sl@0
   241
#endif
sl@0
   242
sl@0
   243
#if __GNUC_PREREQ__(3, 3)
sl@0
   244
#define __nonnull(x)	__attribute__((__nonnull__(x)))
sl@0
   245
#else
sl@0
   246
#define __nonnull(x)
sl@0
   247
#endif
sl@0
   248
sl@0
   249
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
sl@0
   250
#if __STDC_VERSION__ < 199901
sl@0
   251
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
sl@0
   252
#define	__func__	""
sl@0
   253
#endif
sl@0
   254
#endif
sl@0
   255
sl@0
   256
#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
sl@0
   257
#ifdef __SYMBIAN32__
sl@0
   258
#ifndef __LONG_LONG_SUPPORTED
sl@0
   259
#define	__LONG_LONG_SUPPORTED
sl@0
   260
#endif /* __LONG_LONG_SUPPORTED */
sl@0
   261
#else
sl@0
   262
#define	__LONG_LONG_SUPPORTED
sl@0
   263
#endif /* __SYMBIAN32__ */
sl@0
   264
#endif
sl@0
   265
sl@0
   266
#ifdef __SYMBIAN32__
sl@0
   267
#if ((defined(__ARMCC__) && (__ARMCC_VERSION > 220000) ) || (defined(__WINSCW__)))
sl@0
   268
#ifndef __LONG_LONG_SUPPORTED
sl@0
   269
#define __LONG_LONG_SUPPORTED
sl@0
   270
#endif /* __LONG_LONG_SUPPORTED */
sl@0
   271
#endif
sl@0
   272
#endif /*__SYMBIAN32__*/
sl@0
   273
sl@0
   274
sl@0
   275
/*
sl@0
   276
 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
sl@0
   277
 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
sl@0
   278
 * a way to define the `restrict' type qualifier without disturbing older
sl@0
   279
 * software that is unaware of C99 keywords.
sl@0
   280
 */
sl@0
   281
#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
sl@0
   282
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
sl@0
   283
#define	__restrict
sl@0
   284
#else
sl@0
   285
#define	__restrict	restrict
sl@0
   286
#endif
sl@0
   287
#endif
sl@0
   288
sl@0
   289
/*
sl@0
   290
 * GNU C version 2.96 adds explicit branch prediction so that
sl@0
   291
 * the CPU back-end can hint the processor and also so that
sl@0
   292
 * code blocks can be reordered such that the predicted path
sl@0
   293
 * sees a more linear flow, thus improving cache behavior, etc.
sl@0
   294
 *
sl@0
   295
 * The following two macros provide us with a way to utilize this
sl@0
   296
 * compiler feature.  Use __predict_true() if you expect the expression
sl@0
   297
 * to evaluate to true, and __predict_false() if you expect the
sl@0
   298
 * expression to evaluate to false.
sl@0
   299
 *
sl@0
   300
 * A few notes about usage:
sl@0
   301
 *
sl@0
   302
 *	* Generally, __predict_false() error condition checks (unless
sl@0
   303
 *	  you have some _strong_ reason to do otherwise, in which case
sl@0
   304
 *	  document it), and/or __predict_true() `no-error' condition
sl@0
   305
 *	  checks, assuming you want to optimize for the no-error case.
sl@0
   306
 *
sl@0
   307
 *	* Other than that, if you don't know the likelihood of a test
sl@0
   308
 *	  succeeding from empirical or other `hard' evidence, don't
sl@0
   309
 *	  make predictions.
sl@0
   310
 *
sl@0
   311
 *	* These are meant to be used in places that are run `a lot'.
sl@0
   312
 *	  It is wasteful to make predictions in code that is run
sl@0
   313
 *	  seldomly (e.g. at subsystem initialization time) as the
sl@0
   314
 *	  basic block reordering that this affects can often generate
sl@0
   315
 *	  larger code.
sl@0
   316
 */
sl@0
   317
#if __GNUC_PREREQ__(2, 96)
sl@0
   318
#define __predict_true(exp)     __builtin_expect((exp), 1)
sl@0
   319
#define __predict_false(exp)    __builtin_expect((exp), 0)
sl@0
   320
#else
sl@0
   321
#define __predict_true(exp)     (exp)
sl@0
   322
#define __predict_false(exp)    (exp)
sl@0
   323
#endif
sl@0
   324
sl@0
   325
/*
sl@0
   326
 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
sl@0
   327
 * require it.
sl@0
   328
 */
sl@0
   329
#if !defined(__cplusplus)
sl@0
   330
#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
sl@0
   331
#else
sl@0
   332
#if defined(__GNUC__)
sl@0
   333
#if(__GNUC__ > 3)
sl@0
   334
#define __offsetof(type, field)					\
sl@0
   335
       (__builtin_offsetof (type,field))
sl@0
   336
#else
sl@0
   337
#define __offsetof(type, field)					\
sl@0
   338
       (__offsetof__ (type,field))
sl@0
   339
#endif
sl@0
   340
#else
sl@0
   341
#define	__offsetof(type, field)	((size_t)(&((type *)0)->field))
sl@0
   342
#endif
sl@0
   343
#endif
sl@0
   344
sl@0
   345
#define	__rangeof(type, start, end) \
sl@0
   346
	(__offsetof(type, end) - __offsetof(type, start))
sl@0
   347
sl@0
   348
/*
sl@0
   349
 * Compiler-dependent macros to declare that functions take printf-like
sl@0
   350
 * or scanf-like arguments.  They are null except for versions of gcc
sl@0
   351
 * that are known to support the features properly (old versions of gcc-2
sl@0
   352
 * didn't permit keeping the keywords out of the application namespace).
sl@0
   353
 */
sl@0
   354
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
sl@0
   355
#define	__printflike(fmtarg, firstvararg)
sl@0
   356
#define	__scanflike(fmtarg, firstvararg)
sl@0
   357
#else
sl@0
   358
#define	__printflike(fmtarg, firstvararg) \
sl@0
   359
	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
sl@0
   360
#define	__scanflike(fmtarg, firstvararg) \
sl@0
   361
	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
sl@0
   362
#endif
sl@0
   363
sl@0
   364
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
sl@0
   365
#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
sl@0
   366
#define	__printf0like(fmtarg, firstvararg) \
sl@0
   367
	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
sl@0
   368
#else
sl@0
   369
#define	__printf0like(fmtarg, firstvararg)
sl@0
   370
#endif
sl@0
   371
sl@0
   372
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
sl@0
   373
#ifndef __INTEL_COMPILER
sl@0
   374
#define	__strong_reference(sym,aliassym)	\
sl@0
   375
	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
sl@0
   376
#endif
sl@0
   377
#ifdef __STDC__
sl@0
   378
#define	__weak_reference(sym,alias)	\
sl@0
   379
	__asm__(".weak " #alias);	\
sl@0
   380
	__asm__(".equ "  #alias ", " #sym)
sl@0
   381
#define	__warn_references(sym,msg)	\
sl@0
   382
	__asm__(".section .gnu.warning." #sym);	\
sl@0
   383
	__asm__(".asciz \"" msg "\"");	\
sl@0
   384
	__asm__(".previous")
sl@0
   385
#else
sl@0
   386
#define	__weak_reference(sym,alias)	\
sl@0
   387
	__asm__(".weak alias");		\
sl@0
   388
	__asm__(".equ alias, sym")
sl@0
   389
#define	__warn_references(sym,msg)	\
sl@0
   390
	__asm__(".section .gnu.warning.sym"); \
sl@0
   391
	__asm__(".asciz \"msg\"");	\
sl@0
   392
	__asm__(".previous")
sl@0
   393
#endif	/* __STDC__ */
sl@0
   394
#endif	/* __GNUC__ || __INTEL_COMPILER */
sl@0
   395
sl@0
   396
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
sl@0
   397
#define	__IDSTRING(name,string)	__asm__(".ident\t\"" string "\"")
sl@0
   398
#else
sl@0
   399
/*
sl@0
   400
 * The following definition might not work well if used in header files,
sl@0
   401
 * but it should be better than nothing.  If you want a "do nothing"
sl@0
   402
 * version, then it should generate some harmless declaration, such as:
sl@0
   403
 *    #define __IDSTRING(name,string)	struct __hack
sl@0
   404
 */
sl@0
   405
#define	__IDSTRING(name,string)	static const char name[] __unused = string
sl@0
   406
#endif
sl@0
   407
sl@0
   408
/*
sl@0
   409
 * Embed the rcs id of a source file in the resulting library.  Note that in
sl@0
   410
 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
sl@0
   411
 * Usage:
sl@0
   412
 *	__FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.88.2.1 2005/10/09 07:48:48 netchild Exp $");
sl@0
   413
 */
sl@0
   414
#ifndef	__FBSDID
sl@0
   415
#if !defined(lint) && !defined(STRIP_FBSDID)
sl@0
   416
#define	__FBSDID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
sl@0
   417
#else
sl@0
   418
#define	__FBSDID(s)	struct __hack
sl@0
   419
#endif
sl@0
   420
#endif
sl@0
   421
sl@0
   422
#ifndef	__RCSID
sl@0
   423
#ifndef	NO__RCSID
sl@0
   424
#define	__RCSID(s)	__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
sl@0
   425
#else
sl@0
   426
#define	__RCSID(s)	struct __hack
sl@0
   427
#endif
sl@0
   428
#endif
sl@0
   429
sl@0
   430
#ifndef	__RCSID_SOURCE
sl@0
   431
#ifndef	NO__RCSID_SOURCE
sl@0
   432
#define	__RCSID_SOURCE(s)	__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
sl@0
   433
#else
sl@0
   434
#define	__RCSID_SOURCE(s)	struct __hack
sl@0
   435
#endif
sl@0
   436
#endif
sl@0
   437
sl@0
   438
#ifndef	__SCCSID
sl@0
   439
#ifndef	NO__SCCSID
sl@0
   440
#define	__SCCSID(s)	__IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
sl@0
   441
#else
sl@0
   442
#define	__SCCSID(s)	struct __hack
sl@0
   443
#endif
sl@0
   444
#endif
sl@0
   445
sl@0
   446
#ifndef	__COPYRIGHT
sl@0
   447
#ifndef	NO__COPYRIGHT
sl@0
   448
#define	__COPYRIGHT(s)	__IDSTRING(__CONCAT(__copyright_,__LINE__),s)
sl@0
   449
#else
sl@0
   450
#define	__COPYRIGHT(s)	struct __hack
sl@0
   451
#endif
sl@0
   452
#endif
sl@0
   453
sl@0
   454
#ifndef	__DECONST
sl@0
   455
#define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
sl@0
   456
#endif
sl@0
   457
sl@0
   458
#ifndef	__DEVOLATILE
sl@0
   459
#define	__DEVOLATILE(type, var)	((type)(uintptr_t)(volatile void *)(var))
sl@0
   460
#endif
sl@0
   461
sl@0
   462
#ifndef	__DEQUALIFY
sl@0
   463
#define	__DEQUALIFY(type, var)	((type)(uintptr_t)(const volatile void *)(var))
sl@0
   464
#endif
sl@0
   465
sl@0
   466
/*-
sl@0
   467
 * The following definitions are an extension of the behavior originally
sl@0
   468
 * implemented in <sys/_posix.h>, but with a different level of granularity.
sl@0
   469
 * POSIX.1 requires that the macros we test be defined before any standard
sl@0
   470
 * header file is included.
sl@0
   471
 *
sl@0
   472
 * Here's a quick run-down of the versions:
sl@0
   473
 *  defined(_POSIX_SOURCE)		1003.1-1988
sl@0
   474
 *  _POSIX_C_SOURCE == 1		1003.1-1990
sl@0
   475
 *  _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option
sl@0
   476
 *  _POSIX_C_SOURCE == 199309		1003.1b-1993
sl@0
   477
 *  _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995,
sl@0
   478
 *					and the omnibus ISO/IEC 9945-1: 1996
sl@0
   479
 *  _POSIX_C_SOURCE == 200112		1003.1-2001
sl@0
   480
 *
sl@0
   481
 * In addition, the X/Open Portability Guide, which is now the Single UNIX
sl@0
   482
 * Specification, defines a feature-test macro which indicates the version of
sl@0
   483
 * that specification, and which subsumes _POSIX_C_SOURCE.
sl@0
   484
 *
sl@0
   485
 * Our macros begin with two underscores to avoid namespace screwage.
sl@0
   486
 */
sl@0
   487
sl@0
   488
/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
sl@0
   489
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
sl@0
   490
#undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */
sl@0
   491
#define	_POSIX_C_SOURCE		199009
sl@0
   492
#endif
sl@0
   493
sl@0
   494
/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
sl@0
   495
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
sl@0
   496
#undef _POSIX_C_SOURCE
sl@0
   497
#define	_POSIX_C_SOURCE		199209
sl@0
   498
#endif
sl@0
   499
sl@0
   500
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
sl@0
   501
#ifdef _XOPEN_SOURCE
sl@0
   502
#if _XOPEN_SOURCE - 0 >= 600
sl@0
   503
#define	__XSI_VISIBLE		600
sl@0
   504
#undef _POSIX_C_SOURCE
sl@0
   505
#define	_POSIX_C_SOURCE		200112
sl@0
   506
#elif _XOPEN_SOURCE - 0 >= 500
sl@0
   507
#define	__XSI_VISIBLE		500
sl@0
   508
#undef _POSIX_C_SOURCE
sl@0
   509
#define	_POSIX_C_SOURCE		199506
sl@0
   510
#endif
sl@0
   511
#endif
sl@0
   512
sl@0
   513
/*
sl@0
   514
 * Deal with all versions of POSIX.  The ordering relative to the tests above is
sl@0
   515
 * important.
sl@0
   516
 */
sl@0
   517
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
sl@0
   518
#define	_POSIX_C_SOURCE		198808
sl@0
   519
#endif
sl@0
   520
#ifdef _POSIX_C_SOURCE
sl@0
   521
#if _POSIX_C_SOURCE >= 200112
sl@0
   522
#ifdef __SYMBIAN32__
sl@0
   523
#define	__XSI_VISIBLE		600
sl@0
   524
#define	__BSD_VISIBLE		1
sl@0
   525
#endif //__SYMBIAN32__
sl@0
   526
#define	__POSIX_VISIBLE		200112
sl@0
   527
#define	__ISO_C_VISIBLE		1999
sl@0
   528
#elif _POSIX_C_SOURCE >= 199506
sl@0
   529
#define	__POSIX_VISIBLE		199506
sl@0
   530
#define	__ISO_C_VISIBLE		1990
sl@0
   531
#elif _POSIX_C_SOURCE >= 199309
sl@0
   532
#define	__POSIX_VISIBLE		199309
sl@0
   533
#define	__ISO_C_VISIBLE		1990
sl@0
   534
#elif _POSIX_C_SOURCE >= 199209
sl@0
   535
#define	__POSIX_VISIBLE		199209
sl@0
   536
#define	__ISO_C_VISIBLE		1990
sl@0
   537
#elif _POSIX_C_SOURCE >= 199009
sl@0
   538
#define	__POSIX_VISIBLE		199009
sl@0
   539
#define	__ISO_C_VISIBLE		1990
sl@0
   540
#else
sl@0
   541
#define	__POSIX_VISIBLE		198808
sl@0
   542
#define	__ISO_C_VISIBLE		0
sl@0
   543
#endif /* _POSIX_C_SOURCE */
sl@0
   544
#else
sl@0
   545
/*-
sl@0
   546
 * Deal with _ANSI_SOURCE:
sl@0
   547
 * If it is defined, and no other compilation environment is explicitly
sl@0
   548
 * requested, then define our internal feature-test macros to zero.  This
sl@0
   549
 * makes no difference to the preprocessor (undefined symbols in preprocessing
sl@0
   550
 * expressions are defined to have value zero), but makes it more convenient for
sl@0
   551
 * a test program to print out the values.
sl@0
   552
 *
sl@0
   553
 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
sl@0
   554
 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
sl@0
   555
 * environment (and in fact we will never get here).
sl@0
   556
 */
sl@0
   557
#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
sl@0
   558
#define	__POSIX_VISIBLE		0
sl@0
   559
#define	__XSI_VISIBLE		0
sl@0
   560
#define	__BSD_VISIBLE		0
sl@0
   561
#define	__ISO_C_VISIBLE		1990
sl@0
   562
#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
sl@0
   563
#define	__POSIX_VISIBLE		0
sl@0
   564
#define	__XSI_VISIBLE		0
sl@0
   565
#define	__BSD_VISIBLE		0
sl@0
   566
#define	__ISO_C_VISIBLE		1999
sl@0
   567
#else				/* Default environment: show everything. */
sl@0
   568
#define	__POSIX_VISIBLE		200112
sl@0
   569
#define	__XSI_VISIBLE		600
sl@0
   570
#define	__BSD_VISIBLE		1
sl@0
   571
#define	__ISO_C_VISIBLE		1999
sl@0
   572
#endif
sl@0
   573
#endif
sl@0
   574
sl@0
   575
#endif /* !_SYS_CDEFS_H_ */