Nested declarations are easy to avoid, and doing so avoids at least libvirt's choice of compiler warnings.
* lib/strerror_r.c (strerror_r): Hoist extern declaration to top level. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 4 ++++ lib/strerror_r.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a5ca61..4c94e4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-03-29 Eric Blake <[email protected]> + strerror_r: avoid compiler warning + * lib/strerror_r.c (strerror_r): Hoist extern declaration to top + level. + fflush: avoid compiler warning * lib/fflush.c (update_fpos_cache): Mark variables that are potentially unused. diff --git a/lib/strerror_r.c b/lib/strerror_r.c index be76b0d..76f6fc6 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -34,6 +34,7 @@ #if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */ # define USE_XPG_STRERROR_R 1 +extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen); #elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) @@ -161,8 +162,6 @@ strerror_r (int errnum, char *buf, size_t buflen) #if USE_XPG_STRERROR_R { - extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen); - ret = __xpg_strerror_r (errnum, buf, buflen); if (ret < 0) ret = errno; -- 1.7.7.6
