mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Initial import
This commit is contained in:
commit
c91b3c5006
14915 changed files with 590219 additions and 0 deletions
34
libc/integral/cxx.inc
Normal file
34
libc/integral/cxx.inc
Normal file
|
@ -0,0 +1,34 @@
|
|||
#define COSMOPOLITAN_CPP_START_ namespace cosmo {
|
||||
#define COSMOPOLITAN_CPP_END_ }
|
||||
#define COSMOPOLITAN_CPP_USING_ using namespace cosmo;
|
||||
#define COSMOPOLITAN_C_START_ extern "C" {
|
||||
#define COSMOPOLITAN_C_END_ }
|
||||
|
||||
#if !defined(__builtin_types_compatible_p) && !__has_builtin(types_compatible_p)
|
||||
#if 0 /* todo jart whyyyy */
|
||||
#include "libc/integral/cxxtypescompat.inc"
|
||||
#define __builtin_types_compatible_p(A, B) \
|
||||
(__cxx_types_compatible<A, B>::_value)
|
||||
#else
|
||||
#define __builtin_types_compatible_p(A, B) 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__builtin_choose_expr) && !__has_builtin(choose_expr)
|
||||
#if 1
|
||||
template <bool _P, typename _T, typename _U>
|
||||
struct __cxx_choose_expr {
|
||||
__cxx_choose_expr(_T _a, _U _b) : _value(_a) {}
|
||||
const _T _value;
|
||||
};
|
||||
template <typename _T, typename _U>
|
||||
struct __cxx_choose_expr<false, _T, _U> {
|
||||
__cxx_choose_expr(_T _a, _U _b) : _value(_b) {}
|
||||
const _U _value;
|
||||
};
|
||||
#define __builtin_choose_expr(X, A, B) \
|
||||
(__cxx_choose_expr<X, typeof(A), typeof(B)>(A, B)._value)
|
||||
#else
|
||||
#define __builtin_choose_expr(X, A, B) ((X) ? (A) : (B))
|
||||
#endif
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue