This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Mar 2011 09:14:39 +0000
- Subject: [Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array
- Auto-submitted: auto-generated
- References: <bug-36299-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299
--- Comment #4 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2011-03-01 09:14:27 UTC ---
(In reply to comment #3)
>
> The documentation should be improved anyway (the word "suspicious" is very
> subjective).
>
Please propose a patch.
> > You should be able to work-around the macro case by casting the array to (char
> > *) or perhaps casting to (void *) ?
>
> Yes, this makes sense. Perhaps this should be documented.
Is it working? I meant to say "ideally" one should be able to do this but I
don't think it is working right now (and probably there are not testcases
testing this).
>
> How about something like __extension__, e.g. __no_warnings__ would disable the
> warnings for the following statement or expression? If expression, one could
There was a patch floating around in gcc-patches to implement that but since
GCC location info is far from perfect (especially on macro expansions), I think
it won't work well in practice. Moreover, the preferred way is to use the
existing diagnostic pragmas.
http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html