patch: __env_lock/__env_unlock prototypes
J. Johnston
jjohnstn@cygnus.com
Thu Aug 24 09:15:00 GMT 2000
Werner Almesberger wrote:
>
> This patch adds prototypes to envlock.h, which fixes two warnings in each
> of getenv_r.c and setenv_r.c.
>
Thanks Werner. Patch is applied. I also changed the documentation in mlock.c
which had the same inconsistency that envlock.c did.
-- Jeff Johnston (Red Hat Inc.)
> Hmm, as people watch in silent horror, maybe I should explain what I'm
> doing: I'm trying to get a reasonably clean build with -Wall, mainly to
> find my own bugs, but I think it can only help if other code doesn't
> yield tons of unnecessary warnings too. I'm grouping my patches by
> their complexity and by how controversial their inclusion may be, e.g.
> the missing includes patch is a direct application of POSIX.1, while
> this one re-arranges an internal interface, and the next one will deal
> with gcc-isms.
>
> Current status: I'm pretty much through with headers/prototypes (at
> least as far as -Wall is concerned - -Wmissing-prototypes may be
> another story). Now there are plenty of "might be used uninitialized"
> and "suggest parentheses" warnings, particularly in libm. I've looked
> at a few of them, mainly those in libc, and the code looks correct, so
> I don't want to do a lot about them. I'll make a patch for a few
> trivial cases of "suggest parentheses", though. Then I'll shut up
> again ;-)
>
> - Werner
>
> ---------------------------------- ChangeLog ----------------------------------
>
> 2000-08-23 Werner Almesberger <Werner.Almesberger@epfl.ch>
> * libc/stdlib/envlock.c: changed documented "__env_lock" and
> "__env_unlock" prototype from "void *" or "char *" to
> "struct _reent *" to match real function
> * libc/stdlib/envlock.h: added "__env_lock" and "__env_unlock"
> prototypes (for getenv_r.c and setenv_r.c)
> * libc/stdlib/envlock.c: included envlock.h for "__env_lock" and
> "__env_unlock" prototypes
>
> ------------------------------------ patch ------------------------------------
>
> --- orig/newlib/libc/stdlib/envlock.c Wed Mar 22 01:09:49 2000
> +++ src/newlib/libc/stdlib/envlock.c Wed Aug 23 20:45:02 2000
> @@ -9,15 +9,15 @@
>
> ANSI_SYNOPSIS
> #include "envlock.h"
> - void __env_lock (void *<[reent]>);
> - void __env_unlock (void *<[reent]>);
> + void __env_lock (struct _reent *<[reent]>);
> + void __env_unlock (struct _reent *<[reent]>);
>
> TRAD_SYNOPSIS
> void __env_lock(<[reent]>)
> - char *<[reent]>;
> + struct _reent *<[reent]>;
>
> void __env_unlock(<[reent]>)
> - char *<[reent]>;
> + struct _reent *<[reent]>;
>
> DESCRIPTION
> The <<setenv>> family of routines call these functions when they need
> @@ -34,6 +34,9 @@
> routines must be careful to avoid causing a thread to wait for a lock
> that it already holds.
> */
> +
> +#include "envlock.h"
> +
>
> void
> __env_lock (ptr)
> --- orig/newlib/libc/stdlib/envlock.h Thu Feb 17 20:39:47 2000
> +++ src/newlib/libc/stdlib/envlock.h Wed Aug 23 20:48:24 2000
> @@ -9,4 +9,7 @@
> #define ENV_LOCK __env_lock(reent_ptr)
> #define ENV_UNLOCK __env_unlock(reent_ptr)
>
> +void _EXFUN(__env_lock,(struct _reent *reent));
> +void _EXFUN(__env_unlock,(struct _reent *reent));
> +
> #endif /* _INCLUDE_ENVLOCK_H_ */
>
> --
> _________________________________________________________________________
> / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch /
> /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
More information about the Newlib
mailing list