This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: some 64-bit-ness in libio
- To: rth at cygnus dot com, peeterj at ca dot ibm dot com, jakub at redhat dot com
- Subject: Re: some 64-bit-ness in libio
- From: Christian Iseli <chris at lslsun dot epfl dot ch>
- Date: Mon, 8 May 2000 18:06:50 +0200 (MET DST)
- Cc: gcc at gcc dot gnu dot org
Richard said:
> I think the proper fix is to change the C++ front end not
> to warn about casting constants to pointers.
> The C front end does this, and I believe the C++ front end
> used to, but doesn't anymore for reasons I don't understand.
Ok, I just checked how the C front-end does the trick, and did the same for
the C++ front-end. Rebuilt and checked, with good testsuite results.
Here is the patch...
Regards,
Christian
2000-05-08 Christian Iseli <chris@cmpteam4.unil.ch>
* typeck.c (build_c_cast): Don't warn on pointer cast of constants
--- gcc/gcc/cp/typeck.c.chris Thu May 4 11:00:10 2000
+++ gcc/gcc/cp/typeck.c Mon May 8 13:40:01 2000
@@ -5481,9 +5481,13 @@ build_c_cast (type, expr)
if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (otype) == INTEGER_TYPE
&& TYPE_PRECISION (type) != TYPE_PRECISION (otype)
+#if 0
/* Don't warn about converting 0 to pointer,
provided the 0 was explicit--not cast or made by folding. */
&& !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value)))
+#endif
+ /* Don't warn about converting any constant. */
+ && !TREE_CONSTANT (value))
warning ("cast to pointer from integer of different size");
if (TREE_CODE (type) == REFERENCE_TYPE)