This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: patch: unused variables
- To: Werner Almesberger <almesber at lrc dot epfl dot ch>
- Subject: Re: patch: unused variables
- From: "J. Johnston" <jjohnstn at cygnus dot com>
- Date: Thu, 24 Aug 2000 12:27:55 -0400
- CC: newlib at sources dot redhat dot com
- Organization: Red Hat Inc.
- References: <200008230726.JAA18521@lrcsun15.epfl.ch>
Werner Almesberger wrote:
>
> Here's a patch that eliminates a few unused variable warnings.
>
> Some of my changes are of the controversial type
> #ifdef SOMETHING
> int foo;
> #endif
>
> An alternative would be to define a macro __UNUSED or such that becomes
> __attribute__((unused)) with GCC, nothing with other compilers, leave
> the variables in, and flag them with __UNUSED. Probably overkill, but
> if somebody really hates those mini-ifdefs, I'll make a patch with
> __UNUSED.
>
The defines you chose to use were quite appropriate. Patch has been applied.
-- Jeff Johnston (Red Hat Inc)
> ---------------------------------- ChangeLog ----------------------------------
>
> 2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
> * libc/stdio/stdio.c (__swrite): declare "oldmode" only if it's
> used later (ifdef __SCLE)
> * libc/stdio/vfscanf.c (__svfscanf): declare "state" only if it's
> used later (ifdef MB_CAPABLE)
> * libc/string/memset.c (memset): removed unused variables "count"
> and "unaligned_addr"
> * libc/locale/locale.c (_setlocale_r): declare "lc_ctype" and
> "last_lc_ctype" only of they're used later (ifdef MB_CAPABLE)
> * libc/unix/getpwent.c (getpwnam): removed unused variables "uid"
> and "gid"
>