------- Comment #18 from l dot lunak at suse dot cz  2010-02-14 21:47 -------
(In reply to comment #17)
> Which one? We are not going to warn for conversions to boolean and we are not
> going to warn for explicit conversions.

 I don't see anybody asking for that.

> And we are not going to warn by default, only with -Wconversion.

 If you fail to see the difference between NULL being converted to integer
being almost always a mistake and the flood of warnings caused by -Wcoversion
to be almost almost harmless in real-world code, then you probably might as
well not bother at all. A warning about something that's almost for sure a
mistake being part of a flag that almost nobody uses is next to useless.

> So, please post a testcase as minimal and self-contained (with the smallest
> number of includes) as possible and point out
> exactly what you expect to happen.

Well, it's all in the original comment of this bugreport, but if you insist:

Testcase (a.c):

#include <stddef.h>
void foo( int a );
int main()
    {
    foo( NULL );
    foo( 0 );
    int a = NULL;
    return 0;
    }

Expected output (like 'gcc -Wall -c a.c' provides):

a.c: In function &#8216;main&#8217;:
a.c:5: warning: passing argument 1 of &#8216;foo&#8217; makes integer from
pointer without a cast
a.c:2: note: expected &#8216;int&#8217; but argument is of type &#8216;void
*&#8217;
a.c:7: warning: initialization makes integer from pointer without a cast
a.c:7: warning: unused variable &#8216;a&#8217;

Actual output (what 'g++ -Wall -c a.c' provides):

a.c: In function &#8216;int main()&#8217;:
a.c:7: warning: unused variable &#8216;a&#8217;

The warning about the unused variable is obviously irrelevant.


-- 

l dot lunak at suse dot cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35669

Reply via email to