Note that there are some explanatory texts on larger screens.

plurals
  1. PO-Wall without -Wreturn-type
    text
    copied!<p>According to the GCC manual, the <code>-Wreturn-type</code> options is enabled with <code>-Wall</code>. However, I can't find a proper way to disable it while keeping the rest of <code>-Wall</code> enabled.</p> <p>Consider this code:</p> <pre><code>func() {} </code></pre> <p>If compiled without warnings, no output is produced. Now, if I turn on <code>-Wall</code> the following lines will appear:</p> <pre class="lang-none prettyprint-override"><code>$ gcc fn.c -Wall fn.c:1: warning: return type defaults to ‘int’ fn.c: In function ‘func’: fn.c:1: warning: control reaches end of non-void function </code></pre> <p>Ok, all nice. Now, if compiled with <code>-Wreturn-type</code>, the same output is produced:</p> <pre class="lang-none prettyprint-override"><code>$ gcc fn.c -Wreturn-type fn.c:1: warning: return type defaults to ‘int’ fn.c: In function ‘func’: fn.c:1: warning: control reaches end of non-void function </code></pre> <p>So, I conclude that <code>-Wreturn-type</code> is responsible for those warnings. But maybe it's not, or I'm doing something worse, as this was expected to produce no output:</p> <pre class="lang-none prettyprint-override"><code>$ gcc fn.c -Wall -Wno-return-type fn.c:1: warning: return type defaults to ‘int’ </code></pre> <p>Is it possible to use <code>-Wall</code> but disable <code>-Wreturn-type</code> completely? Or maybe I'm missing another available option?</p> <p>If it matters, I'm on Mac OS 10.7 (Darwin 11) with GCC 4.2.1 (strangely enough, compiled with LLVM :P)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload