[LLVMdev] Unreachable code in Mutex.cpp

Chandler Carruth chandlerc at google.com
Sat Jan 14 23:43:00 PST 2012


On Sat, Jan 14, 2012 at 5:17 PM, David Blaikie <dblaikie at gmail.com> wrote:

> 1) two instances of code deliberately if(false)ed out with comments
> explaining that developers can bring it back in once something works
> or to aid in debugging. I switched these to #if 0 instead - I realize
> this means those code snippets may bitrot since they won't be compiled
> anymore. Is this the right thing? Should we have some construct for
> "deliberately unreachable" code like this?
>

IMHO, the weird syntax is already in use, and -Wunreachable-code shouldn't
warn on this. Blatantly deliberate stuff isn't interesting to me as a
compiler warning, especially as it makes debugging code very annoying. I
want to be able to random place 'if (0)' into code as needed during
debugging without having a -Werror build break.

I would exempt 0 and false is whole conditions, or maybe others...

Anyways, my 2 cents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120114/4158c3ae/attachment.html>


More information about the llvm-dev mailing list