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.