C PATCH to rectify warning for character types (PR c/23087)

Martin Sebor msebor@gmail.com
Sat Jan 9 01:21:00 GMT 2016


> The point of this warning is that there are certain cases of incompatible
> types that are less serious than others - namely, those where the only
> aspect of the type that is different is its signedness.  Those get a more
> specific warning, which is given under more restrictive conditions.

I see.  It means the warnings aren't based on the C definitions
of signedness or compatibility but rather on our perception of
the likely correctness of the code we've seen violate the
constraints implied by the definitions.

FWIW, I have no objection to treating the three character types
as special as you suggest.  But I also feel that -Wincompatible-
pointer-types is more appropriate than -Wpointer-sign, not only
for the reason stated in the bug but also because it more closely
corresponds to the C definitions of the terms.  Perhaps tweaking
the patch by adding an option, say -Wincompatible-char, to make
it possible to enable and disable the warning for the character
types, would be an acceptable compromise.  It would satisfy
the user's request and avoid the potential fallout you and Marek
are concerned about.

Martin



More information about the Gcc-patches mailing list