avoid warning on explicit 'bool <- restricted' casts
commit4e5bb8cfb75de82915cd6a17bbc8a9409d2137de
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Fri, 19 May 2017 00:30:39 +0000 (19 02:30 +0200)
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Fri, 19 May 2017 04:51:34 +0000 (19 06:51 +0200)
treedbae91a0fe7fe572e4547cd44a5d77e2c12339c7
parent28ba15f4e8ce477726e80b1e22677fe144973b49
avoid warning on explicit 'bool <- restricted' casts

Conversion to bool is special in C since this conversion
is essentially the result of the comparison with zero.
As such, some operations which are normally unsafe to
do with restricted types, like casting to an unrestricted
type, are in fact safe to do when converting to bool
and issuing a warning in those case is useless, confusing
and causes people to add useless casts in the code in
order to shut up the warning.

Fix this by catching explicit 'bool <- restricted type' casts
and not emit a warning like for others casts of restricted
type to non-restrictes ones.

Based-on-patch-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
evaluate.c
validation/bool-cast-bad.c
validation/bool-cast-explicit.c
validation/bool-cast-restricted.c