Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable warning/error for default warnings
    primarykey
    data
    text
    <p>We want to start using <code>-Wall -Werror</code> on a large project.<br> Due to the size, this change has to be phased, and we want to start with the most important warnings first.</p> <p>The best way to do it seems to be using <code>-Wall -Werror</code>, with exceptions for specific warnings. The exceptional warnings are those which we have a lot of (so fixing them all is hard and risky), and we don't consider them very dangerous.<br> I'm not saying we don't want to fix all these warnings - just not on the first phase.</p> <p>I know two ways to exclude a warning from <code>-Werror</code> - the best is <code>-Wno-error=xxx</code>, and if it doesn't work - <code>-Wno-xxx</code> (of course, we prefer to see the warning and ignore it, rather than hide it). </p> <p>My problem is with warnings which are enabled by default, and don't have a <code>-Wxxx</code> flag related to them. I couldn't find any way to alllow them when <code>-Werror</code> is used.</p> <p>I'm specifically concerned about two specific warnings. Here's a program that exhibits them and the compiler output:</p> <pre><code>#include &lt;stdio.h&gt; void f(int *p) { printf("%p\n", p); } int main(int argc, char *argv[]) { const int *p = NULL; const unsigned int *q = NULL; f(p); /* Line 7: p is const, f expects non const */ if (p == q) { /* Line 8: p is signed, q is unsigned */ printf("Both NULL\n"); } return 0; } % gcc warn.c warn.c: In function 'main': warn.c:7: warning: passing argument 1 of 'f' discards qualifiers from pointer target type warn.c:8: warning: comparison of distinct pointer types lacks a cast </code></pre> <p>I know the best solution is to fix these warnings, but it's much easier said than done. In order for this change to be successful, we have to do this phased, and can't do too many changes at once. </p> <p>Any suggestions? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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