cdefs.h revision 1.119
1/*	$NetBSD: cdefs.h,v 1.119 2014/03/13 20:36:01 pooka Exp $	*/
2
3/* * Copyright (c) 1991, 1993
4 *	The Regents of the University of California.  All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Berkeley Software Design, Inc.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
34 */
35
36#ifndef	_SYS_CDEFS_H_
37#define	_SYS_CDEFS_H_
38
39/*
40 * Macro to test if we're using a GNU C compiler of a specific vintage
41 * or later, for e.g. features that appeared in a particular version
42 * of GNU C.  Usage:
43 *
44 *	#if __GNUC_PREREQ__(major, minor)
45 *	...cool feature...
46 *	#else
47 *	...delete feature...
48 *	#endif
49 */
50#ifdef __GNUC__
51#define	__GNUC_PREREQ__(x, y)						\
52	((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) ||			\
53	 (__GNUC__ > (x)))
54#else
55#define	__GNUC_PREREQ__(x, y)	0
56#endif
57
58#include <machine/cdefs.h>
59#ifdef __ELF__
60#include <sys/cdefs_elf.h>
61#else
62#include <sys/cdefs_aout.h>
63#endif
64
65#ifdef __GNUC__
66#define	__strict_weak_alias(alias,sym)					\
67	__unused static __typeof__(alias) *__weak_alias_##alias = &sym;	\
68	__weak_alias(alias,sym)
69#else
70#define	__strict_weak_alias(alias,sym) __weak_alias(alias,sym)
71#endif
72
73/*
74 * Optional marker for size-optimised MD calling convention.
75 */
76#ifndef __compactcall
77#define	__compactcall
78#endif
79
80/*
81 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
82 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
83 * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
84 * in between its arguments.  __CONCAT can also concatenate double-quoted
85 * strings produced by the __STRING macro, but this only works with ANSI C.
86 */
87
88#define	___STRING(x)	__STRING(x)
89#define	___CONCAT(x,y)	__CONCAT(x,y)
90
91#if __STDC__ || defined(__cplusplus)
92#define	__P(protos)	protos		/* full-blown ANSI C */
93#define	__CONCAT(x,y)	x ## y
94#define	__STRING(x)	#x
95
96#define	__const		const		/* define reserved names to standard */
97#define	__signed	signed
98#define	__volatile	volatile
99#if defined(__cplusplus) || defined(__PCC__)
100#define	__inline	inline		/* convert to C++/C99 keyword */
101#else
102#if !defined(__GNUC__) && !defined(__lint__)
103#define	__inline			/* delete GCC keyword */
104#endif /* !__GNUC__  && !__lint__ */
105#endif /* !__cplusplus */
106
107#else	/* !(__STDC__ || __cplusplus) */
108#define	__P(protos)	()		/* traditional C preprocessor */
109#define	__CONCAT(x,y)	x/**/y
110#define	__STRING(x)	"x"
111
112#ifndef __GNUC__
113#define	__const				/* delete pseudo-ANSI C keywords */
114#define	__inline
115#define	__signed
116#define	__volatile
117#endif	/* !__GNUC__ */
118
119/*
120 * In non-ANSI C environments, new programs will want ANSI-only C keywords
121 * deleted from the program and old programs will want them left alone.
122 * Programs using the ANSI C keywords const, inline etc. as normal
123 * identifiers should define -DNO_ANSI_KEYWORDS.
124 */
125#ifndef	NO_ANSI_KEYWORDS
126#define	const		__const		/* convert ANSI C keywords */
127#define	inline		__inline
128#define	signed		__signed
129#define	volatile	__volatile
130#endif /* !NO_ANSI_KEYWORDS */
131#endif	/* !(__STDC__ || __cplusplus) */
132
133/*
134 * Used for internal auditing of the NetBSD source tree.
135 */
136#ifdef __AUDIT__
137#define	__aconst	__const
138#else
139#define	__aconst
140#endif
141
142/*
143 * Compile Time Assertion.
144 */
145#ifdef __COUNTER__
146#define	__CTASSERT(x)		__CTASSERT0(x, __ctassert, __COUNTER__)
147#else
148#define	__CTASSERT(x)		__CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__)
149#define	__CTASSERT99(x, a, b)	__CTASSERT0(x, __CONCAT(__ctassert,a), \
150					       __CONCAT(_,b))
151#endif
152#define	__CTASSERT0(x, y, z)	__CTASSERT1(x, y, z)
153#define	__CTASSERT1(x, y, z)	typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1] __unused
154
155/*
156 * The following macro is used to remove const cast-away warnings
157 * from gcc -Wcast-qual; it should be used with caution because it
158 * can hide valid errors; in particular most valid uses are in
159 * situations where the API requires it, not to cast away string
160 * constants. We don't use *intptr_t on purpose here and we are
161 * explicit about unsigned long so that we don't have additional
162 * dependencies.
163 */
164#define __UNCONST(a)	((void *)(unsigned long)(const void *)(a))
165
166/*
167 * The following macro is used to remove the volatile cast-away warnings
168 * from gcc -Wcast-qual; as above it should be used with caution
169 * because it can hide valid errors or warnings.  Valid uses include
170 * making it possible to pass a volatile pointer to memset().
171 * For the same reasons as above, we use unsigned long and not intptr_t.
172 */
173#define __UNVOLATILE(a)	((void *)(unsigned long)(volatile void *)(a))
174
175/*
176 * GCC2 provides __extension__ to suppress warnings for various GNU C
177 * language extensions under "-ansi -pedantic".
178 */
179#if !__GNUC_PREREQ__(2, 0)
180#define	__extension__		/* delete __extension__ if non-gcc or gcc1 */
181#endif
182
183/*
184 * GCC1 and some versions of GCC2 declare dead (non-returning) and
185 * pure (no side effects) functions using "volatile" and "const";
186 * unfortunately, these then cause warnings under "-ansi -pedantic".
187 * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
188 * these work for GNU C++ (modulo a slight glitch in the C++ grammar
189 * in the distribution version of 2.5.5).
190 *
191 * GCC defines a pure function as depending only on its arguments and
192 * global variables.  Typical examples are strlen and sqrt.
193 *
194 * GCC defines a const function as depending only on its arguments.
195 * Therefore calling a const function again with identical arguments
196 * will always produce the same result.
197 *
198 * Rounding modes for floating point operations are considered global
199 * variables and prevent sqrt from being a const function.
200 *
201 * Calls to const functions can be optimised away and moved around
202 * without limitations.
203 */
204#if !__GNUC_PREREQ__(2, 0)
205#define __attribute__(x)
206#endif
207
208#if __GNUC_PREREQ__(2, 5)
209#define	__dead		__attribute__((__noreturn__))
210#elif defined(__GNUC__)
211#define	__dead		__volatile
212#else
213#define	__dead
214#endif
215
216#if __GNUC_PREREQ__(2, 96)
217#define	__pure		__attribute__((__pure__))
218#elif defined(__GNUC__)
219#define	__pure		__const
220#else
221#define	__pure
222#endif
223
224#if __GNUC_PREREQ__(2, 5)
225#define	__constfunc	__attribute__((__const__))
226#else
227#define	__constfunc
228#endif
229
230#if __GNUC_PREREQ__(3, 0)
231#define	__noinline	__attribute__((__noinline__))
232#else
233#define	__noinline	/* nothing */
234#endif
235
236#if __GNUC_PREREQ__(3, 0)
237#define	__always_inline	__attribute__((__always_inline__))
238#else
239#define	__always_inline	/* nothing */
240#endif
241
242#if __GNUC_PREREQ__(4, 1)
243#define	__returns_twice	__attribute__((__returns_twice__))
244#else
245#define	__returns_twice	/* nothing */
246#endif
247
248#if __GNUC_PREREQ__(4, 5)
249#define	__noclone	__attribute__((__noclone__))
250#else
251#define	__noclone	/* nothing */
252#endif
253
254/*
255 * __unused: Note that item or function might be unused.
256 */
257#if __GNUC_PREREQ__(2, 7)
258#define	__unused	__attribute__((__unused__))
259#else
260#define	__unused	/* delete */
261#endif
262
263/*
264 * __used: Note that item is needed, even if it appears to be unused.
265 */
266#if __GNUC_PREREQ__(3, 1)
267#define	__used		__attribute__((__used__))
268#else
269#define	__used		__unused
270#endif
271
272/*
273 * __diagused: Note that item is used in diagnostic code, but may be
274 * unused in non-diagnostic code.
275 */
276#if (defined(_KERNEL) && defined(DIAGNOSTIC)) \
277 || (!defined(_KERNEL) && !defined(NDEBUG))
278#define	__diagused	/* empty */
279#else
280#define	__diagused	__unused
281#endif
282
283/*
284 * __debugused: Note that item is used in debug code, but may be
285 * unused in non-debug code.
286 */
287#if defined(DEBUG)
288#define	__debugused	/* empty */
289#else
290#define	__debugused	__unused
291#endif
292
293#if __GNUC_PREREQ__(3, 1)
294#define	__noprofile	__attribute__((__no_instrument_function__))
295#else
296#define	__noprofile	/* nothing */
297#endif
298
299#if defined(__cplusplus)
300#define	__BEGIN_EXTERN_C	extern "C" {
301#define	__END_EXTERN_C		}
302#define	__static_cast(x,y)	static_cast<x>(y)
303#else
304#define	__BEGIN_EXTERN_C
305#define	__END_EXTERN_C
306#define	__static_cast(x,y)	(x)y
307#endif
308
309#if __GNUC_PREREQ__(4, 0)
310#  define __dso_public	__attribute__((__visibility__("default")))
311#  define __dso_hidden	__attribute__((__visibility__("hidden")))
312#  define __BEGIN_PUBLIC_DECLS	\
313	_Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
314#  define __END_PUBLIC_DECLS	__END_EXTERN_C _Pragma("GCC visibility pop")
315#  define __BEGIN_HIDDEN_DECLS	\
316	_Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
317#  define __END_HIDDEN_DECLS	__END_EXTERN_C _Pragma("GCC visibility pop")
318#else
319#  define __dso_public
320#  define __dso_hidden
321#  define __BEGIN_PUBLIC_DECLS	__BEGIN_EXTERN_C
322#  define __END_PUBLIC_DECLS	__END_EXTERN_C
323#  define __BEGIN_HIDDEN_DECLS	__BEGIN_EXTERN_C
324#  define __END_HIDDEN_DECLS	__END_EXTERN_C
325#endif
326#if __GNUC_PREREQ__(4, 2)
327#  define __dso_protected	__attribute__((__visibility__("protected")))
328#else
329#  define __dso_protected
330#endif
331
332#define	__BEGIN_DECLS		__BEGIN_PUBLIC_DECLS
333#define	__END_DECLS		__END_PUBLIC_DECLS
334
335/*
336 * Non-static C99 inline functions are optional bodies.  They don't
337 * create global symbols if not used, but can be replaced if desirable.
338 * This differs from the behavior of GCC before version 4.3.  The nearest
339 * equivalent for older GCC is `extern inline'.  For newer GCC, use the
340 * gnu_inline attribute additionally to get the old behavior.
341 *
342 * For C99 compilers other than GCC, the C99 behavior is expected.
343 */
344#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
345#define	__c99inline	extern __attribute__((__gnu_inline__)) __inline
346#elif defined(__GNUC__)
347#define	__c99inline	extern __inline
348#elif defined(__STDC_VERSION__)
349#define	__c99inline	__inline
350#endif
351
352#if defined(__lint__)
353#define	__packed	__packed
354#define	__aligned(x)	/* delete */
355#define	__section(x)	/* delete */
356#elif __GNUC_PREREQ__(2, 7)
357#define	__packed	__attribute__((__packed__))
358#define	__aligned(x)	__attribute__((__aligned__(x)))
359#define	__section(x)	__attribute__((__section__(x)))
360#elif defined(__PCC__)
361#define	__packed	_Pragma("packed 1")
362#define	__aligned(x)   	_Pragma("aligned " __STRING(x))
363#define	__section(x)   	_Pragma("section " ## x)
364#elif defined(_MSC_VER)
365#define	__packed	/* ignore */
366#else
367#define	__packed	error: no __packed for this compiler
368#define	__aligned(x)	error: no __aligned for this compiler
369#define	__section(x)	error: no __section for this compiler
370#endif
371
372/*
373 * C99 defines the restrict type qualifier keyword, which was made available
374 * in GCC 2.92.
375 */
376#if defined(__lint__)
377#define	__restrict	/* delete __restrict when not supported */
378#elif __STDC_VERSION__ >= 199901L
379#define	__restrict	restrict
380#elif __GNUC_PREREQ__(2, 92)
381#define	__restrict	__restrict__
382#else
383#define	__restrict	/* delete __restrict when not supported */
384#endif
385
386/*
387 * C99 defines __func__ predefined identifier, which was made available
388 * in GCC 2.95.
389 */
390#if !(__STDC_VERSION__ >= 199901L)
391#if __GNUC_PREREQ__(2, 6)
392#define	__func__	__PRETTY_FUNCTION__
393#elif __GNUC_PREREQ__(2, 4)
394#define	__func__	__FUNCTION__
395#else
396#define	__func__	""
397#endif
398#endif /* !(__STDC_VERSION__ >= 199901L) */
399
400#if defined(_KERNEL)
401#if defined(NO_KERNEL_RCSIDS)
402#undef __KERNEL_RCSID
403#define	__KERNEL_RCSID(_n, _s)		/* nothing */
404#endif /* NO_KERNEL_RCSIDS */
405#endif /* _KERNEL */
406
407#if !defined(_STANDALONE) && !defined(_KERNEL)
408#if defined(__GNUC__) || defined(__PCC__)
409#define	__RENAME(x)	___RENAME(x)
410#elif defined(__lint__)
411#define	__RENAME(x)	__symbolrename(x)
412#else
413#error "No function renaming possible"
414#endif /* __GNUC__ */
415#else /* _STANDALONE || _KERNEL */
416#define	__RENAME(x)	no renaming in kernel or standalone environment
417#endif
418
419/*
420 * A barrier to stop the optimizer from moving code or assume live
421 * register values. This is gcc specific, the version is more or less
422 * arbitrary, might work with older compilers.
423 */
424#if __GNUC_PREREQ__(2, 95)
425#define	__insn_barrier()	__asm __volatile("":::"memory")
426#else
427#define	__insn_barrier()	/* */
428#endif
429
430/*
431 * GNU C version 2.96 adds explicit branch prediction so that
432 * the CPU back-end can hint the processor and also so that
433 * code blocks can be reordered such that the predicted path
434 * sees a more linear flow, thus improving cache behavior, etc.
435 *
436 * The following two macros provide us with a way to use this
437 * compiler feature.  Use __predict_true() if you expect the expression
438 * to evaluate to true, and __predict_false() if you expect the
439 * expression to evaluate to false.
440 *
441 * A few notes about usage:
442 *
443 *	* Generally, __predict_false() error condition checks (unless
444 *	  you have some _strong_ reason to do otherwise, in which case
445 *	  document it), and/or __predict_true() `no-error' condition
446 *	  checks, assuming you want to optimize for the no-error case.
447 *
448 *	* Other than that, if you don't know the likelihood of a test
449 *	  succeeding from empirical or other `hard' evidence, don't
450 *	  make predictions.
451 *
452 *	* These are meant to be used in places that are run `a lot'.
453 *	  It is wasteful to make predictions in code that is run
454 *	  seldomly (e.g. at subsystem initialization time) as the
455 *	  basic block reordering that this affects can often generate
456 *	  larger code.
457 */
458#if __GNUC_PREREQ__(2, 96)
459#define	__predict_true(exp)	__builtin_expect((exp) != 0, 1)
460#define	__predict_false(exp)	__builtin_expect((exp) != 0, 0)
461#else
462#define	__predict_true(exp)	(exp)
463#define	__predict_false(exp)	(exp)
464#endif
465
466/*
467 * Compiler-dependent macros to declare that functions take printf-like
468 * or scanf-like arguments.  They are null except for versions of gcc
469 * that are known to support the features properly (old versions of gcc-2
470 * didn't permit keeping the keywords out of the application namespace).
471 */
472#if __GNUC_PREREQ__(2, 7)
473#define __printflike(fmtarg, firstvararg)	\
474	    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
475#define __scanflike(fmtarg, firstvararg)	\
476	    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
477#define __format_arg(fmtarg)    __attribute__((__format_arg__ (fmtarg)))
478#else
479#define __printflike(fmtarg, firstvararg)	/* nothing */
480#define __scanflike(fmtarg, firstvararg)	/* nothing */
481#define __format_arg(fmtarg)			/* nothing */
482#endif
483
484/*
485 * Macros for manipulating "link sets".  Link sets are arrays of pointers
486 * to objects, which are gathered up by the linker.
487 *
488 * Object format-specific code has provided us with the following macros:
489 *
490 *	__link_set_add_text(set, sym)
491 *		Add a reference to the .text symbol `sym' to `set'.
492 *
493 *	__link_set_add_rodata(set, sym)
494 *		Add a reference to the .rodata symbol `sym' to `set'.
495 *
496 *	__link_set_add_data(set, sym)
497 *		Add a reference to the .data symbol `sym' to `set'.
498 *
499 *	__link_set_add_bss(set, sym)
500 *		Add a reference to the .bss symbol `sym' to `set'.
501 *
502 *	__link_set_decl(set, ptype)
503 *		Provide an extern declaration of the set `set', which
504 *		contains an array of pointers to type `ptype'.  This
505 *		macro must be used by any code which wishes to reference
506 *		the elements of a link set.
507 *
508 *	__link_set_start(set)
509 *		This points to the first slot in the link set.
510 *
511 *	__link_set_end(set)
512 *		This points to the (non-existent) slot after the last
513 *		entry in the link set.
514 *
515 *	__link_set_count(set)
516 *		Count the number of entries in link set `set'.
517 *
518 * In addition, we provide the following macros for accessing link sets:
519 *
520 *	__link_set_foreach(pvar, set)
521 *		Iterate over the link set `set'.  Because a link set is
522 *		an array of pointers, pvar must be declared as "type **pvar",
523 *		and the actual entry accessed as "*pvar".
524 *
525 *	__link_set_entry(set, idx)
526 *		Access the link set entry at index `idx' from set `set'.
527 */
528#define	__link_set_foreach(pvar, set)					\
529	for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
530
531#define	__link_set_entry(set, idx)	(__link_set_start(set)[idx])
532
533/*
534 * Return the natural alignment in bytes for the given type
535 */
536#if __GNUC_PREREQ__(4, 1)
537#define	__alignof(__t)  __alignof__(__t)
538#else
539#define __alignof(__t) (sizeof(struct { char __x; __t __y; }) - sizeof(__t))
540#endif
541
542/*
543 * Return the number of elements in a statically-allocated array,
544 * __x.
545 */
546#define	__arraycount(__x)	(sizeof(__x) / sizeof(__x[0]))
547
548#ifndef __ASSEMBLER__
549/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
550#define	__BIT(__n)	\
551    (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1))))
552
553/* __BITS(m, n): bits m through n, m < n. */
554#define	__BITS(__m, __n)	\
555	((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
556#endif /* !__ASSEMBLER__ */
557
558/* find least significant bit that is set */
559#define	__LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
560
561#define	__PRIuBIT	PRIuMAX
562#define	__PRIuBITS	__PRIuBIT
563
564#define	__PRIxBIT	PRIxMAX
565#define	__PRIxBITS	__PRIxBIT
566
567#define	__SHIFTOUT(__x, __mask)	(((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
568#define	__SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
569#define	__SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
570
571/*
572 * Only to be used in other headers that are included from both c or c++
573 * NOT to be used in code.
574 */
575#ifdef __cplusplus
576#define __CAST(__dt, __st)	static_cast<__dt>(__st)
577#else
578#define __CAST(__dt, __st)	((__dt)(__st))
579#endif
580
581#define __USE(a) ((void)(a))
582
583#define __type_mask(t) (/*LINTED*/sizeof(t) < sizeof(intmax_t) ? \
584    (~((1ULL << (sizeof(t) * NBBY)) - 1)) : 0ULL)
585
586#ifndef __ASSEMBLER__
587static __inline long long __zeroll(void) { return 0; }
588static __inline unsigned long long __zeroull(void) { return 0; }
589#else
590#define __zeroll() (0LL)
591#define __zeroull() (0ULL)
592#endif
593
594#define __negative_p(x) (!((x) > 0) && ((x) != 0))
595
596#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * NBBY - 1))))
597#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * NBBY - 1))))
598#define __type_min_u(t) ((t)0ULL)
599#define __type_max_u(t) ((t)~0ULL)
600#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1)
601#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t))
602#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t))
603
604
605#define __type_fit_u(t, a) (/*LINTED*/!__negative_p(a) && \
606    (uintmax_t)((a) + __zeroull()) <= (uintmax_t)__type_max_u(t))
607
608#define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \
609    ((intmax_t)((a) + __zeroll()) >= (intmax_t)__type_min_s(t)) : \
610    ((intmax_t)((a) + __zeroll()) >= (intmax_t)0 && \
611     (intmax_t)((a) + __zeroll()) <= (intmax_t)__type_max_s(t)))
612
613/*
614 * return true if value 'a' fits in type 't'
615 */
616#define __type_fit(t, a) (__type_is_signed(t) ? \
617    __type_fit_s(t, a) : __type_fit_u(t, a))
618
619#endif /* !_SYS_CDEFS_H_ */
620