On Tue, Jun 3, 2014 at 7:35 PM, enh <e...@google.com> wrote:
> GCC 4.9 complains:
>
> bionic/libc/upstream-openbsd/lib/libc/stdio/vfwprintf.c:328:16: error:
> variable 'uio' set but not used [-Werror=unused-but-set-variable]
>   struct __suio uio; /* output information: summary */
>                 ^
>
> suggested patch:


I can't really comment on the correctness of your patch without fully
working through the code, but I'll note that vfwprintf.c was derived
from vfprintf.c and that file looks like it has a PRINT macro which
makes use of uio.

Do you know if something was overlooked in the process of converting
vfprintf to vfwprintf where uio should actually be used inside
vfwprintf? Or did you work out that nothing was missed during that
conversion and your patch below is definitely the correct one.

Either way I can vouch for the comment at the top of both files "This
code is large and complicated..."


>
> diff --git a/libc/upstream-openbsd/lib/libc/stdio/vfwprintf.c
> b/libc/upstream-openbsd/lib/libc/stdio/vfwprintf.c
> index 745b4d9..0ac346a 100644
> --- a/lib/libc/stdio/vfwprintf.c
> +++ b/lib/libc/stdio/vfwprintf.c
> @@ -325,8 +325,6 @@ __vfwprintf(FILE * __restrict fp, const wchar_t *
> __restrict fmt0, __va_list ap)
>   int size; /* size of converted field or string */
>   const char *xdigs; /* digits for %[xX] conversion */
>  #define NIOV 8
> - struct __suio uio; /* output information: summary */
> - struct __siov iov[NIOV];/* ... and individual io vectors */
>   wchar_t buf[BUF]; /* buffer with space for digits of uintmax_t */
>   wchar_t ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
>   union arg *argtable; /* args, built due to positional arg */
> @@ -463,9 +461,6 @@ __vfwprintf(FILE * __restrict fp, const wchar_t *
> __restrict fmt0, __va_list ap)
>   argtable = NULL;
>   nextarg = 1;
>   va_copy(orgap, ap);
> - uio.uio_iov = iov;
> - uio.uio_resid = 0;
> - uio.uio_iovcnt = 0;
>   ret = 0;
>   convbuf = NULL;
>
>  --elliott
>

Reply via email to