From e97e3a48d3a23446cf334e288aa6f138a6f9bae5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 30 Nov 2008 17:10:29 +0100 Subject: [PATCH] avoid misc. warnings * lib/fsusage.c (UNUSED_PARAM): Define. (get_fs_usage): Mark parameter "disk" as unused. * lib/getugroups.c (getgrent): Use "void" in prototype. * lib/mountlist.c: Mark unused parameters. (read_file_system_list): Declare a local with "const". * lib/nanosleep.c (getnow): Declare static. * lib/strftime.c: Include strftime.h, for declaration of nstrftime. --- ChangeLog | 9 +++++++++ lib/fsusage.c | 11 +++++++++-- lib/getugroups.c | 2 +- lib/mountlist.c | 24 ++++++++++++++++++------ lib/nanosleep.c | 2 +- lib/strftime.c | 2 ++ 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 337783704..5f72527e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2009-02-04 Jim Meyering + avoid misc. warnings + * lib/fsusage.c (UNUSED_PARAM): Define. + (get_fs_usage): Mark parameter "disk" as unused. + * lib/getugroups.c (getgrent): Use "void" in prototype. + * lib/mountlist.c: Mark unused parameters. + (read_file_system_list): Declare a local with "const". + * lib/nanosleep.c (getnow): Declare static. + * lib/strftime.c: Include strftime.h, for declaration of nstrftime. + dirfd: set errno upon failure * lib/dirfd.c: Include . Set errno to ENOTSUP when returning -1. diff --git a/lib/fsusage.c b/lib/fsusage.c index 23d40ea1d..f4bda097f 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -1,6 +1,6 @@ /* fsusage.c -- return space usage of mounted file systems - Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005, 2006 + Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -84,6 +84,12 @@ otherwise, use PROPAGATE_ALL_ONES. */ #define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1)) +#ifdef STAT_READ_FILSYS +# define UNUSED_PARAM /* empty */ +#else +# define UNUSED_PARAM _UNUSED_PARAMETER_ +#endif + /* Fill in the fields of FSP with information about space usage for the file system on which FILE resides. DISK is the device on which FILE is mounted, for space-getting @@ -92,7 +98,8 @@ ERRNO is either a system error value, or zero if DISK is NULL on a system that requires a non-NULL value. */ int -get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) +get_fs_usage (char const *file, char const *disk UNUSED_PARAM, + struct fs_usage *fsp) { #if defined STAT_STATVFS /* POSIX */ diff --git a/lib/getugroups.c b/lib/getugroups.c index e102f21ca..b266bb8c3 100644 --- a/lib/getugroups.c +++ b/lib/getugroups.c @@ -32,7 +32,7 @@ /* Some old header files might not declare setgrent, getgrent, and endgrent. If you don't have them at all, we can't implement this function. You lose! */ -struct group *getgrent (); +struct group *getgrent (void); #include diff --git a/lib/mountlist.c b/lib/mountlist.c index 4c975c63e..119cdf00a 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -1,7 +1,6 @@ /* mountlist.c -- return a list of mounted file systems - Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1997-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -298,11 +297,17 @@ fstype_to_string (int t) #if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2 +#undef UNUSED_PARAM +#ifdef __linux__ +# define UNUSED_PARAM _UNUSED_PARAMETER_ +#else +# define UNUSED_PARAM +#endif + /* Return the device number from MOUNT_OPTIONS, if possible. Otherwise return (dev_t) -1. */ - static dev_t -dev_from_mount_options (char const *mount_options) +dev_from_mount_options (char const *mount_options UNUSED_PARAM) { /* GNU/Linux allows file system implementations to define their own meaning for "dev=" mount options, so don't trust the meaning @@ -333,13 +338,20 @@ dev_from_mount_options (char const *mount_options) #endif +#undef UNUSED_PARAM +#ifdef GETFSTYP +# define UNUSED_PARAM +#else +# define UNUSED_PARAM _UNUSED_PARAMETER_ +#endif + /* Return a list of the currently mounted file systems, or NULL on error. Add each entry to the tail of the list so that they stay in order. If NEED_FS_TYPE is true, ensure that the file system type fields in the returned list are valid. Otherwise, they might not be. */ struct mount_entry * -read_file_system_list (bool need_fs_type) +read_file_system_list (bool need_fs_type UNUSED_PARAM) { struct mount_entry *mount_list; struct mount_entry *me; @@ -378,7 +390,7 @@ read_file_system_list (bool need_fs_type) #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ { struct mntent *mnt; - char *table = MOUNTED; + char const *table = MOUNTED; FILE *fp; fp = setmntent (table, "r"); diff --git a/lib/nanosleep.c b/lib/nanosleep.c index e413c5db0..7a7cc02fd 100644 --- a/lib/nanosleep.c +++ b/lib/nanosleep.c @@ -42,7 +42,7 @@ enum { BILLION = 1000 * 1000 * 1000 }; #if HAVE_BUG_BIG_NANOSLEEP -void +static void getnow (struct timespec *t) { # if defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME diff --git a/lib/strftime.c b/lib/strftime.c index ea425c4e3..fff5d38ea 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -28,6 +28,8 @@ # include # if FPRINTFTIME # include "fprintftime.h" +# else +# include "strftime.h" # endif #endif -- 2.11.0