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_abo


From: Paolo Bonzini
Subject: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()
Date: Mon, 15 Mar 2010 19:19:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3


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.

Paolo




reply via email to

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