]>
git.saurik.com Git - apple/libc.git/blob - os/base.h
1 /* Copyright (c) 2012 Apple Inc. All rights reserved.
3 * @APPLE_LICENSE_HEADER_START@
5 * This file contains Original Code and/or Modifications of Original Code
6 * as defined in and that are subject to the Apple Public Source License
7 * Version 2.0 (the 'License'). You may not use this file except in
8 * compliance with the License. Please obtain a copy of the License at
9 * http://www.opensource.apple.com/apsl/ and read it before using this
12 * The Original Code and all software distributed under the License are
13 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 * Please see the License for the specific language governing rights and
18 * limitations under the License.
20 * @APPLE_LICENSE_HEADER_END@
27 #define os_fastpath(x) ((__typeof__(x))(uintptr_t)__builtin_expect((uintptr_t)(x), ~0l))
28 #define os_slowpath(x) ((__typeof__(x))(uintptr_t)__builtin_expect((uintptr_t)(x), 0l))
29 #define os_constant(x) __builtin_constant_p((x))
30 #define os_hardware_trap() __asm__ __volatile__ (""); __builtin_trap()
32 #define __OS_COMPILETIME_ASSERT__(e) __extension__({ \
33 char __compile_time_assert__[(e) ? 1 : -1]; \
34 (void)__compile_time_assert__; \
37 #define __OS_CONST __attribute__((__const__))
38 #define __OS_PRINTFLIKE(x,y) __attribute__((__format__(printf,x,y)))
40 #define os_fastpath(x) (x)
41 #define os_slowpath(x) (x)
42 #define os_constant(x) ((long)0)
43 #define os_hardware_trap() abort()
45 #define __OS_COMPILETIME_ASSERT__(e) (e)
48 #define __OS_PRINTFLIKE(x,y)
51 #endif /* __OS_BASE_H__ */