This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C PATCH to rectify warning for character types (PR c/23087)
- From: Martin Sebor <msebor at gmail dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 08 Jan 2016 18:21:38 -0700
- Subject: Re: C PATCH to rectify warning for character types (PR c/23087)
- Authentication-results: sourceware.org; auth=none
- References: <20160107171127 dot GK31604 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1601072117140 dot 31194 at digraph dot polyomino dot org dot uk> <568FF69B dot 10803 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1601082224450 dot 22470 at digraph dot polyomino dot org dot uk> <56904612 dot 800 at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1601082342120 dot 22470 at digraph dot polyomino dot org dot uk>
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