changeset 11110:23f0d14f8cdc

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.
author Jim Meyering <meyering@redhat.com>
date Sun, 30 Nov 2008 17:10:29 +0100
parents 4ae3959b5ebe
children 52a7f01cf7bb
files ChangeLog lib/fsusage.c lib/getugroups.c lib/mountlist.c lib/nanosleep.c lib/strftime.c
diffstat 6 files changed, 40 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2009-02-04  Jim Meyering  <meyering@redhat.com>
 
+	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 <errno.h>.
 	Set errno to ENOTSUP when returning -1.
--- 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 */
 
--- 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 <string.h>
 
--- 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 @@
 
 #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 @@
 
 #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 @@
 #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");
--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -42,7 +42,7 @@
 
 #if HAVE_BUG_BIG_NANOSLEEP
 
-void
+static void
 getnow (struct timespec *t)
 {
 # if defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -28,6 +28,8 @@
 # include <config.h>
 # if FPRINTFTIME
 #  include "fprintftime.h"
+# else
+#  include "strftime.h"
 # endif
 #endif