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: "vincent at vinc17 dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Aug 2008 20:00:32 -0000
- Subject: [Bug c/36299] spurious and undocumented warning with -Waddress for a == 0 when a is an array
- References: <bug-36299-6373@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from vincent at vinc17 dot org 2008-08-23 20:00 -------
(In reply to comment #2)
> this warning was added on purpose, because probably someone requested it. I
> don't see that it is very different from the documented case of using the
> address of a function in a conditional.
The documentation should be improved anyway (the word "suspicious" is very
subjective).
> 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.
> That said, we would like to not warn within
> macros for a wide range of warnings but we don't have the infrastructure to do
> that yet.
How about something like __extension__, e.g. __no_warnings__ would disable the
warnings for the following statement or expression? If expression, one could
still use __no_warnings__ with ({ ... }). Keywords for individual warnings or
warning groups would even be better. At the same time, it would be nice to have
some macro defined, declaring that such a keyword is available (that would be
much better than testing the GCC version).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299