This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18886] misleading warning from attribute sentinel in C++
- From: "salinger at sun dot felk dot cvut dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Dec 2004 17:07:23 -0000
- Subject: [Bug c++/18886] misleading warning from attribute sentinel in C++
- References: <20041208104431.18886.salinger@sun.felk.cvut.cz>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From salinger at sun dot felk dot cvut dot cz 2004-12-08 17:07 -------
Thanks for explanation.
The warning message was confusing for me.
Could be possible to distinguish between NULL without pointer conversion
and completely forgotten NULL ?
With something like this:
--- gcc/c-common.c.std Wed Dec 8 16:14:12 2004
+++ gcc/c-common.c Wed Dec 8 17:45:03 2004
@@ -5041,7 +5041,12 @@
/* Validate the sentinel. */
if (!POINTER_TYPE_P (TREE_TYPE (TREE_VALUE (sentinel)))
|| !integer_zerop (TREE_VALUE (sentinel)))
- warning ("missing sentinel in function call");
+ {
+ if (!integer_zerop (TREE_VALUE (sentinel)))
+ warning ("missing sentinel in function call");
+ else
+ warning ("wrong sentinel in function call - NULL should be cast
to appropriate pointer type");
+ }
}
}
}
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|RESOLVED |UNCONFIRMED
Keywords| |diagnostic
Resolution|INVALID |
Summary|attribute sentinel doesn't |misleading warning from
|work with C++ |attribute sentinel in C++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18886