This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/3246: gcc -Wconversion doesn't work properly
- To: <ohhara at postech dot edu>
- Subject: Re: c/3246: gcc -Wconversion doesn't work properly
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Tue, 19 Jun 2001 13:13:33 +0100 (BST)
- cc: <gcc-gnats at gcc dot gnu dot org>, <gcc-bugs at gcc dot gnu dot org>
On 19 Jun 2001 ohhara@postech.edu wrote:
> I use many warning options to find my small ( or big ) mistakes.
> Therefore, I tried to use -Wconversion warning option. However, it
> doesn't seem to work properly.
-Wconversion isn't meant for finding mistakes in new code - only for an
initial shake-down after converting ancient (predating the adoption of the
first C standard in 1989) code to modern C with prototypes. The
documentation could be clearer, and there could (and should) be a more
useful version designed to warn about cases relevant to modern code (such
as sign differences causing security holes) only, but that isn't what
-Wconversion was designed to do.
> Why does it prints warning message? Even if I changed "unsigned char"
> to "unsigned short", the same warning message would be printed.
Because with an old-style function definition and no prototype - the sort
of program -Wconversion supposes you have just converted from - the
argument would have been passed as an int. This may not be a useful
warning, but the present -Wconversion isn't particularly. See the GCC
projects list.
--
Joseph S. Myers
jsm28@cam.ac.uk