[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abor
From: |
Blue Swirl |
Subject: |
[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() |
Date: |
Mon, 15 Mar 2010 21:02:01 +0200 |
On 3/15/10, Paolo Bonzini <address@hidden> wrote:
> >
> > > I'd consider not changing assert(0)->abort()
> > > if there is code after the assert that looks like an attempt at
> recovering.
> > > Example:
> > >
> > > if (!p) {
> > > printf ("the impossible has happened!");
> > > assert (0);
> > > }
> > >
> > > return p->q;
> > >
> > > should be changed to abort, while
> > >
> > > if (!p) {
> > > printf ("the impossible has happened!");
> > > assert (0);
> > > return 0;
> > > }
> > >
> > > return p->q;
> > >
> > > should not.
> > >
> >
> > Why not? According to manual page, assert(x) is equal to if (!x) abort().
> > As I mentioned earlier, system emulators don't handle SIGABRT
> >
>
> ... which won't be generated if !NDEBUG. Only if the recovery code makes
> sense, of course. However, my point was that those cases where there is
> recovery code are not no-brainers.
Except that compiling with -DNDEBUG was broken and fixed only recently
with a6c6f76ceb95a0986fd1a36cc30f8241734d20c3. Thus I suspect nobody
uses -DNDEBUG for production builds and the code paths after assert(0)
are untested.
- [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Blue Swirl, 2010/03/13
- Re: [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Edgar E. Iglesias, 2010/03/13
- Re: [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Markus Armbruster, 2010/03/15
- Re: [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Blue Swirl, 2010/03/15
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Paolo Bonzini, 2010/03/15
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Blue Swirl, 2010/03/15
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Paolo Bonzini, 2010/03/15
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(),
Blue Swirl <=
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Markus Armbruster, 2010/03/15
- Re: [Qemu-devel] [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Markus Armbruster, 2010/03/15
- [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Paolo Bonzini, 2010/03/16
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Markus Armbruster, 2010/03/16
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Jamie Lokier, 2010/03/16
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Paolo Bonzini, 2010/03/17
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Blue Swirl, 2010/03/17
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Jamie Lokier, 2010/03/18
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Blue Swirl, 2010/03/19
- Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort(), Markus Armbruster, 2010/03/18