I'm having some trouble getting clang to work with LLVM_ATTRIBUTE_NORETURN defined in Support/Compiler.h. There are several problems:<div><br></div><div>First there's a problem with the macros themselves - AFAIK __declspec(noreturn) has to come at the *front* of the declaration, while __attribute__((noreturn)) has to come *after* it. The usual way of dealing with this is to define a macro which surrounds the declaration like so:</div>

<div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">    LLVM_ATTRIBUTE_NORETURN(void myfunc());</font></div><div><br></div><div>That way the macro can decide whether to put the noreturn attribute either before or after the declaration. But the definitions in Compiler.h aren't written that way:</div>

</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div></div><div><div>

<font class="Apple-style-span" face="'courier new', monospace">#ifdef __GNUC__</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">#define LLVM_ATTRIBUTE_NORETURN __attribute__((noreturn))</font></div>

</div><div><div><font class="Apple-style-span" face="'courier new', monospace">#elif defined(_MSC_VER)</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">#define LLVM_ATTRIBUTE_NORETURN __declspec(noreturn)</font></div>

</div><div><div><font class="Apple-style-span" face="'courier new', monospace">#else</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">#define LLVM_ATTRIBUTE_NORETURN</font></div>

</div><div><div><font class="Apple-style-span" face="'courier new', monospace">#endif</font></div></div></blockquote><div><div><br></div><div>So my first question is - has anyone ever tried using these macros under Windows?</div>

<div><br></div><div>However, there's a more fundamental problem, which is that clang seems to be ignoring the __attribute__((noreturn)) altogether. That is, instead of relying on the above macros, if I just paste the noreturn attribute after my function, I still get "error: control reaches end of non-void function" in many places - errors which I wasn't getting with gcc.</div>

<div><br></div><div>--<br></div><div>--Talin<br>
</div></div>