This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] pointer cast warnings when size matches


Ping?

On May 31, 2006, at 1:04 PM, Devang Patel wrote:
This patch updates -Wint-to-pointer-cast and -Wpointer-to-int-cast options to accept value to enable warnings when size matches. New attribute safe_pointer_cast is available to suppress such warnings for selected integral types.

* c.opt (Wint-to-pointer-cast=, Wpointer-to-int-cast=): New.
* c-typeck.c (build_c_cast): Check warn_pointer_to_int_cast value.
Check warn_int_to_pointer_cast value.
* c-opts.c (c_common_handle_option): Handle OPT_Wint_to_pointer_cast,
OPT_Wint_to_pointer_cast_, OPT_Wpointer_to_int_cast,
OPT_Wpointer_to_int_cast_.
* c-common.c (handle_safe_ponter_cast_attribute): New.
(c_common_attribute): Add entry for safe_pointer_cast.


        * doc/invoke.texi: Document -Wpointer-to-int-cast=2 and
        -Wint-to-pointer-cast=2.
        * doc/extend.texi: Document safe_pointer_cast attribute.

        * gcc.dg/Wpointer-to-int-cast-4.c: New test.
        * gcc.dg/Wpointer-to-int-cast-5.c: New test.
        * gcc.dg/Wint-to-pointer-cast-4.c: New test.
        * gcc.dg/Wint-to-pointer-cast-5.c: New test.

Bootstrapped and tested on powerpc-apple-darwin.

http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01573.html



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]