[patch] clears -Wall warnings

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sun May 18 17:06:29 PDT 2008


On Mon, 19 May 2008, Denys Vlasenko wrote:

> -                       get_terminal_width_height(0, &output_width, NULL);
> +                       get_terminal_width_height(0, &output_width, (unsigned *)NULL);
>
> This cast is not needed.

Alright.  But as it doesn't seem to do any damage, is it bad if it shows
up?

> I applied as much of this patch as needed for -Wall to not complain,
> and enabled -Wall in standard build. In fact, it was already enabled,
> but we also had -Wno-pointer-sign, which hid pointer warnings.
> Now it is removed.

Groovy ;-)

> I do not think adding -W options which will make it necessary to have
> changes like this:
>
> -               col = snprintf(line_buf, scr_width,
> +               col = snprintf(line_buf, (size_t)scr_width,
>
> is useful.

In what way do you mean?
Is it doing any danage?
Increases size?

As I see it, it may be useful as it documents the code.

Are we interested in the -Wconversion compiler option?  It warns about
things like this:

  archival/libunarchive/get_header_tar.c:300: warning: conversion to
  'size_t' from 'off_t' may alter its value

and this:

  include/xatonum.h: In function 'xatou32':
  include/xatonum.h:109: warning: conversion to 'uint32_t' from 'int' may
  change the sign of the result

when using gcc 4.3.


Cheers,

-- 
Cristian


More information about the busybox mailing list