search for: assertion_trap

Displaying 4 results from an estimated 4 matches for "assertion_trap".

2011 Jul 27
0
[LLVMdev] Proposal for better assertions in LLVM
sorry, my previous message got sent too early I think the macro should look something like this: #define ASSERT_STRM(cond,expr) \ do { if (cond) { std::cerr << expr << std::end; assertion_trap (); } } while (false) On Tue, Jul 26, 2011 at 7:57 PM, Nathan Jeffords <blunted2night at gmail.com>wrote: > wrapping the macro's body in: > > do { ... } while (false) > > would make the the macro a proper statement so that: > > if (cond) > ASSERT(some_other_...
2011 Jul 27
3
[LLVMdev] Proposal for better assertions in LLVM
wrapping the macro's body in: do { ... } while (false) would make the the macro a proper statement so that: if (cond) ASSERT(some_other_cond); else do_something_cool (); compiles as expected. IMO, it would work as such #define ASSERT_STM(cond,expr) On Tue, Jul 26, 2011 at 6:36 PM, Reid Kleckner <reid.kleckner at gmail.com>wrote: > He wants to be able to resume execution
2011 Jul 27
5
[LLVMdev] Proposal for better assertions in LLVM
...like this: #include "llvm/Support/raw_ostream.h" namespace llvm { // This just writes out "Assertion Failed" and the file/line number in // a form that IDEs can parse. void assertion_prologue(const char * file, unsigned line); // This does the trap or abort or whatever. void assertion_trap(); #if NDEBUG #define LLVM_ASSERT_STRM(expr, args) do {} while false // Alternatively // #define LLVM_ASSERT_STRM(expr, args) (void)0 #else /// Assertion macro that acts as an error output stream. Typical usage: /// /// LLVM_ASSERT_STRM(a != b, "Expected " << a <&...
2011 Jul 27
1
[LLVMdev] Proposal for better assertions in LLVM
...an Jeffords <blunted2night at gmail.com>wrote: > sorry, my previous message got sent too early > > I think the macro should look something like this: > > #define ASSERT_STRM(cond,expr) \ > do { > if (cond) { > std::cerr << expr << std::end; > assertion_trap (); > } > } while (false) > > > On Tue, Jul 26, 2011 at 7:57 PM, Nathan Jeffords <blunted2night at gmail.com>wrote: > >> wrapping the macro's body in: >> >> do { ... } while (false) >> >> would make the the macro a proper statement so tha...