… | |
… | |
47 | # define decltype(x) __decltype(x) |
47 | # define decltype(x) __decltype(x) |
48 | #elif GCC_VERSION(3,0) |
48 | #elif GCC_VERSION(3,0) |
49 | # define decltype(x) typeof(x) |
49 | # define decltype(x) typeof(x) |
50 | #endif |
50 | #endif |
51 | |
51 | |
52 | #if GCC_VERSION(4,5) && 0 // the #else part is generating better code on 4.5 |
52 | #if GCC_VERSION(4,5) |
53 | # define unreachable() __builtin_unreachable () |
53 | # define unreachable() __builtin_unreachable () |
54 | #else |
54 | #else |
55 | // this seems to work fine, but gcc always emits a warning for it :/ |
55 | // this seems to work fine, but gcc always emits a warning for it :/ |
56 | static inline void unreachable () attribute ((noreturn)); |
56 | static inline void unreachable () attribute ((noreturn)); |
57 | static inline void unreachable () { } |
57 | static inline void unreachable () { } |
… | |
… | |
61 | // is mostly true or mosty false. note that these return |
61 | // is mostly true or mosty false. note that these return |
62 | // booleans, not the expression. |
62 | // booleans, not the expression. |
63 | #define expect_false(expr) expect ((expr) ? 1 : 0, 0) |
63 | #define expect_false(expr) expect ((expr) ? 1 : 0, 0) |
64 | #define expect_true(expr) expect ((expr) ? 1 : 0, 1) |
64 | #define expect_true(expr) expect ((expr) ? 1 : 0, 1) |
65 | |
65 | |
66 | // try to tell the compiler tat some condition is definitely true |
66 | // try to tell the compiler that some condition is definitely true |
67 | #define assume(cond) do { if (!(cond)) unreachable (); } while (0) |
67 | #define assume(cond) do { if (!(cond)) unreachable (); } while (0) |
68 | |
68 | |
69 | #endif |
69 | #endif |
70 | |
70 | |