[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
making coreutils configure `gcc -Wall' clean
From: |
Ralf Wildenhues |
Subject: |
making coreutils configure `gcc -Wall' clean |
Date: |
Thu, 12 Oct 2006 21:41:04 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
The patch below enables CVS coreutils to be built with
../coreutils/configure -C CC='gcc -Wall -Werror -fno-builtin' \
CPPFLAGS=-Dlint
on my GNU/Linux system, after one more tiny patch to gnulib
(sent to its list). Not quite sure if that fits your coding style.
Cheers,
Ralf
2006-10-12 Ralf Wildenhues <address@hidden>
* 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.
Index: configure.ac
===================================================================
RCS file: /cvsroot/coreutils/coreutils/configure.ac,v
retrieving revision 1.89
diff -u -r1.89 configure.ac
--- configure.ac 2 Oct 2006 11:47:48 -0000 1.89
+++ configure.ac 12 Oct 2006 19:40:30 -0000
@@ -58,14 +58,14 @@
# include <stdlib.h>
#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;
@@ -146,7 +146,7 @@
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 <sys/types.h>
-#include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
+#include <utmp.h>]], [[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)
@@ -159,7 +159,7 @@
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 <sys/types.h>
-#include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
+#include <utmpx.h>]], [[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)
@@ -201,7 +201,7 @@
#define _XOPEN_SOURCE
#endif
#include <sys/types.h>
-#include <termios.h>]], [[struct termios t; t.c_line;]])],
+#include <termios.h>]], [[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)
Index: src/who.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/src/who.c,v
retrieving revision 1.114
diff -u -r1.114 who.c
--- src/who.c 12 Sep 2006 23:32:17 -0000 1.114
+++ src/who.c 12 Oct 2006 19:40:30 -0000
@@ -320,7 +320,9 @@
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)
- making coreutils configure `gcc -Wall' clean,
Ralf Wildenhues <=