<br><br><div>On Sun Jan 05 2014 at 5:18:13 PM, Michael Bao <<a href="mailto:mike.h.bao@gmail.com">mike.h.bao@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, Jan 5, 2014 at 7:30 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
>   Is this an existing warning in another compiler?<br>
<br>
The only other compiler I have access to right now is GCC 4.8 and from<br>
what I can tell they do not have this warning. However, their docs say<br>
that it does not make sense for a noreturn function to have a return<br>
type other than void<br>
(<a href="http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Function-Attributes.html" target="_blank">http://gcc.gnu.org/<u></u>onlinedocs/gcc-4.8.0/gcc/<u></u>Function-Attributes.html</a>). </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
>   Is it finding bugs?<br>
<br>
I can't say for sure if this particular would find bugs or not, but I<br>
think marking a noreturn function as having a return type could<br>
potentially be confusing?.<br></blockquote><div><br></div><div>That may not meet the bar for Clang warnings. We tend to only add warnings that have a very high bug-finding, very low false-positive (where false-positive is defined as "flags a case that is not a bug").</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
>   How does this interact with virtual functions? (what if I'm overriding a<br>
>   non-void non-noreturn function with a noreturn function?)<br>
<br>
If I understand your question correctly...I quickly made up this example:<br>
class TestClass {<br>
  virtual int cfoo() {<br>
    return 0;<br>
   }<br>
};<br>
<br>
class TestClass2: public TestClass {<br>
  __attribute__((noreturn)) virtual int cfoo() {<br>
    while(1){}<br>
    return 1;<br>
   }<br>
};<br>
<br>
The warning is emitted on the cfoo() function in TestClass2 as expected.<br></blockquote><div><br></div><div>"as expected" may be a problem. What should the user do in this case? Is there any way to suppress the warning here if this is the API the user desires?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks!<br>
</blockquote>