[LLVMdev] Proposal for better assertions in LLVM
Nathan Jeffords
blunted2night at gmail.com
Tue Jul 26 20:01:56 PDT 2011
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_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 from the debugger after
>> assertion failure.
>>
>> Reid
>>
>> On Tue, Jul 26, 2011 at 8:07 PM, Alistair Lynn <arplynn at gmail.com> wrote:
>> > Hi-
>> >
>> >> Yep, but tripping the debugger is highly non-portable.
>> >
>> > You're suggesting that inline asm is more portable than calling abort?
>> >
>> > Alistair
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110726/7c10b60f/attachment.html>
More information about the llvm-dev
mailing list