From: Jim Meyering Date: Thu, 12 Oct 2006 20:39:33 +0000 (+0000) Subject: * configure.ac: Avoid compiler warnings about default return X-Git-Tag: COREUTILS-6_4~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f70d6021b216fc36b5260a7a18f00f0acc27482;p=thirdparty%2Fcoreutils.git * configure.ac: Avoid compiler warnings about default return type in function definitions and unused variables in tests. * src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed if this is #defined. --- diff --git a/ChangeLog b/ChangeLog index d27c9e1385..c5b4309119 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-12 Ralf Wildenhues + + * configure.ac: Avoid compiler warnings about default return + type in function definitions and unused variables in tests. + * src/who.c (print_user) [HAVE_UT_HOST]: hostlen is only needed + if this is #defined. + 2006-10-12 Jim Meyering * configure.ac: Reflect s/gl_MACROS/coreutils_MACROS/ renaming. diff --git a/configure.ac b/configure.ac index 19020f8ef8..c3f8b442d9 100644 --- a/configure.ac +++ b/configure.ac @@ -59,14 +59,14 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include # include #endif extern char **environ; -unset_TZ () +void unset_TZ (void) { char **from, **to; for (to = from = environ; (*to = *from); from++) if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '=')) to++; } -main() +int main() { time_t now = time ((time_t *) 0); int hour_GMT0, hour_unset; @@ -147,7 +147,7 @@ coreutils_DUMMY_1 AC_MSG_CHECKING(ut_host in struct utmp) AC_CACHE_VAL(su_cv_func_ut_host_in_utmp, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -#include ]], [[struct utmp ut; ut.ut_host;]])], +#include ]], [[struct utmp ut; return !sizeof ut.ut_host;]])], [su_cv_func_ut_host_in_utmp=yes], [su_cv_func_ut_host_in_utmp=no])]) AC_MSG_RESULT($su_cv_func_ut_host_in_utmp) @@ -160,7 +160,7 @@ if test -z "$have_ut_host"; then AC_MSG_CHECKING(ut_host in struct utmpx) AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include -#include ]], [[struct utmpx ut; ut.ut_host;]])], +#include ]], [[struct utmpx ut; return !sizeof ut.ut_host;]])], [su_cv_func_ut_host_in_utmpx=yes], [su_cv_func_ut_host_in_utmpx=no])]) AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx) @@ -202,7 +202,7 @@ yes #define _XOPEN_SOURCE #endif #include -#include ]], [[struct termios t; t.c_line;]])], +#include ]], [[struct termios t; return !sizeof t.c_line;]])], [su_cv_sys_c_line_in_termios=yes], [su_cv_sys_c_line_in_termios=no])]) AC_MSG_RESULT($su_cv_sys_c_line_in_termios) diff --git a/src/who.c b/src/who.c index 211b08fb7c..db3af6e185 100644 --- a/src/who.c +++ b/src/who.c @@ -320,7 +320,9 @@ print_user (const STRUCT_UTMP *utmp_ent, time_t boottime) char mesg; char idlestr[IDLESTR_LEN + 1]; static char *hoststr; +#if HAVE_UT_HOST static size_t hostlen; +#endif #define DEV_DIR_WITH_TRAILING_SLASH "/dev/" #define DEV_DIR_LEN (sizeof (DEV_DIR_WITH_TRAILING_SLASH) - 1)