qemu-devel
[Top][All Lists]
Advanced

[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 20:26:46 +0200

On 3/15/10, Paolo Bonzini <address@hidden> wrote:
>
>
> >
> > >
> > > > I sympathize with the general idea, but I don't like dead code
> > > >
> > > after abort().  What about cleaning that up?
> > >
> > >
> > Good idea, but it should be a separate patch. This patch is "safe",
> > whereas the cleanup patch could cause problems if it's not done
> > carefully.
> >
>
>  This patch is "safe", however 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 and for
user emulators the level of bugginess remains constant (or rather, it
no longer depends on NDEBUG). Therefore the recovery code will never
be executed.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]