]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: fix compiler warnings
authorSami Kerola <kerolasa@iki.fi>
Mon, 25 Jul 2011 19:33:39 +0000 (21:33 +0200)
committerSami Kerola <kerolasa@iki.fi>
Tue, 26 Jul 2011 16:14:19 +0000 (18:14 +0200)
hwclock.c: In function 'manipulate_epoch':
hwclock.c:1299:29: warning: unused parameter 'getepoch' [-Wunused-parameter]
hwclock.c:1299:50: warning: unused parameter 'setepoch' [-Wunused-parameter]
hwclock.c:1300:14: warning: unused parameter 'epoch_opt' [-Wunused-parameter]
hwclock.c:1300:36: warning: unused parameter 'testing' [-Wunused-parameter]
hwclock.c: In function 'usage':
hwclock.c:1373:1: warning: embedding a directive within macro arguments is not portable [enabled by default]
hwclock.c:1377:1: warning: embedding a directive within macro arguments is not portable [enabled by default]
hwclock.c:1383:1: warning: embedding a directive within macro arguments is not portable [enabled by default]
hwclock.c:1385:1: warning: embedding a directive within macro arguments is not portable [enabled by default]

cmos.c: In function 'outb':
cmos.c:84:15: warning: unused parameter 'a' [-Wunused-parameter]
cmos.c:84:22: warning: unused parameter 'b' [-Wunused-parameter]
cmos.c: In function 'inb':
cmos.c:88:13: warning: unused parameter 'c' [-Wunused-parameter]
cmos.c: In function 'atomic':
cmos.c:265:20: warning: unused parameter 'name' [-Wunused-parameter]
cmos.c: In function 'i386_iopl':
cmos.c:544:32: warning: unused parameter 'level' [-Wunused-parameter]
cmos.c: In function 'get_permissions_cmos':
cmos.c:565:8: warning: unused variable 'errsv' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
hwclock/cmos.c
hwclock/hwclock.c

index 89bcc50f9a47034593363e0d13d2c4e24434050c..09b1555dddc9ee1e28728f8774cb0f012e629337 100644 (file)
  * not export that header.
  */
 #undef __i386__
-void outb(int a, int b)
+void outb(int a __attribute__ ((__unused__)),
+         int b __attribute__ ((__unused__)))
 {
 }
 
-int inb(int c)
+int inb(int c __attribute__ ((__unused__)))
 {
        return 0;
 }
@@ -81,11 +82,12 @@ int inb(int c)
 extern unsigned int inb(unsigned long port);
 extern void outb(unsigned char b, unsigned long port);
 #else
-void outb(int a, int b)
+void outb(int a __attribute__ ((__unused__)),
+         int b __attribute__ ((__unused__)))
 {
 }
 
-int inb(int c)
+int inb(int c __attribute__ ((__unused__)))
 {
        return 0;
 }
@@ -298,7 +300,9 @@ atomic(const char *name, unsigned long (*op) (unsigned long), unsigned long arg)
  * TODO: optimize the access to CMOS by mlockall(MCL_CURRENT) and SCHED_FIFO
  */
 static unsigned long
-atomic(const char *name, unsigned long (*op) (unsigned long), unsigned long arg)
+atomic(const char *name __attribute__ ((__unused__)),
+       unsigned long (*op) (unsigned long),
+       unsigned long arg)
 {
        return (*op) (arg);
 }
@@ -603,20 +607,26 @@ static int set_hardware_clock_cmos(const struct tm *new_broken_time)
        return 0;
 }
 
+#if defined(__i386__) || defined(__alpha__)
+# if defined(HAVE_IOPL)
 static int i386_iopl(const int level)
 {
-#if defined(__i386__) || defined(__alpha__)
-#if defined(HAVE_IOPL)
        extern int iopl(const int lvl);
        return iopl(level);
-#else
+}
+# else
+static int i386_iopl(const int level __attribute__ ((__unused__)))
+{
        extern int ioperm(unsigned long from, unsigned long num, int turn_on);
        return ioperm(clock_ctl_addr, 2, 1);
-#endif
+}
+# endif
 #else
+static int i386_iopl(const int level __attribute__ ((__unused__)))
+{
        return -2;
-#endif
 }
+#endif
 
 static int get_permissions_cmos(void)
 {
@@ -624,7 +634,6 @@ static int get_permissions_cmos(void)
 
        if (use_dev_port) {
                if ((dev_port_fd = open("/dev/port", O_RDWR)) < 0) {
-                       int errsv = errno;
                        warn(_("Cannot open /dev/port"));
                        rc = 1;
                } else
index c1ab072cd4440850f60fe385aab8a88e88f580ac..30ee856bd697dd78cf9499338930306565f84fc2 100644 (file)
@@ -1273,22 +1273,30 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile,
  * <epoch> == -1 if the user did not specify an "epoch" option.
  */
 #ifdef __linux__
+/*
+ * Maintenance note: This should work on non-Alpha machines, but the
+ * evidence today (98.03.04) indicates that the kernel only keeps the epoch
+ * value on Alphas. If that is ever fixed, this function should be changed.
+ */
+# ifndef __alpha__
 static void
-manipulate_epoch(const bool getepoch, const bool setepoch,
-                const int epoch_opt, const bool testing)
+manipulate_epoch(const bool getepoch __attribute__ ((__unused__)),
+                const bool setepoch __attribute__ ((__unused__)),
+                const int epoch_opt __attribute__ ((__unused__)),
+                const bool testing __attribute__ ((__unused__)))
 {
-       /*
-        * Maintenance note: This should work on non-Alpha machines, but the
-        * evidence today (98.03.04) indicates that the kernel only keeps
-        * the epoch value on Alphas. If that is ever fixed, this function
-        * should be changed.
-        */
-#ifndef __alpha__
        warnx(_("The kernel keeps an epoch value for the Hardware Clock "
                "only on an Alpha machine.\nThis copy of hwclock was built for "
                "a machine other than Alpha\n(and thus is presumably not running "
                "on an Alpha now).  No action taken."));
-#else
+}
+# else
+static void
+manipulate_epoch(const bool getepoch,
+                const bool setepoch,
+                const int epoch_opt,
+                const bool testing)
+{
        if (getepoch) {
                unsigned long epoch;
 
@@ -1311,9 +1319,9 @@ manipulate_epoch(const bool getepoch, const bool setepoch,
                        printf(_
                               ("Unable to set the epoch value in the kernel.\n"));
        }
-#endif
 }
-#endif
+# endif                /* __alpha__ */
+#endif         /* __linux__ */
 
 static void out_version(void)
 {
@@ -1347,21 +1355,25 @@ static void usage(const char *fmt, ...)
                  "  -w | --systohc      set the hardware clock to the current system time\n"
                  "       --systz        set the system time based on the current timezone\n"
                  "       --adjust       adjust the rtc to account for systematic drift since\n"
-                 "                      the clock was last set or adjusted\n"
+                 "                      the clock was last set or adjusted\n"));
 #ifdef __linux__
-                 "       --getepoch     print out the kernel's hardware clock epoch value\n"
+       fprintf(usageto,
+               _("       --getepoch     print out the kernel's hardware clock epoch value\n"
                  "       --setepoch     set the kernel's hardware clock epoch value to the \n"
-                 "                      value given with --epoch\n"
+                 "                      value given with --epoch\n"));
 #endif
-                 "       --predict      predict rtc reading at time given with --date\n"
+       fprintf(usageto,
+               _("       --predict      predict rtc reading at time given with --date\n"
                  "  -v | --version      print out the version of hwclock to stdout\n"
                  "\nOptions: \n"
                  "  -u | --utc          the hardware clock is kept in UTC\n"
-                 "       --localtime    the hardware clock is kept in local time\n"
+                 "       --localtime    the hardware clock is kept in local time\n"));
 #ifdef __linux__
-                 "  -f | --rtc=path     special /dev/... file to use instead of default\n"
+       fprintf(usageto,
+               _("  -f | --rtc=path     special /dev/... file to use instead of default\n"));
 #endif
-                 "       --directisa    access the ISA bus directly instead of %s\n"
+       fprintf(usageto,
+               _("       --directisa    access the ISA bus directly instead of %s\n"
                  "       --badyear      ignore rtc's year because the bios is broken\n"
                  "       --date         specifies the time to which to set the hardware clock\n"
                  "       --epoch=year   specifies the year which is the beginning of the \n"
@@ -1372,12 +1384,13 @@ static void usage(const char *fmt, ...)
                  "                      %s)\n"
                  "       --test         do everything except actually updating the hardware\n"
                  "                      clock or anything else\n"
-                 "  -D | --debug        debug mode\n" "\n"),
-       _PATH_RTC_DEV, _PATH_ADJPATH, _PATH_ADJPATH);
+                 "  -D | --debug        debug mode\n" "\n"), _PATH_RTC_DEV,
+                _PATH_ADJPATH, _PATH_ADJPATH);
 #ifdef __alpha__
-       fprintf(usageto, _("  -J|--jensen, -A|--arc, -S|--srm, -F|--funky-toy\n"
-                          "       tell hwclock the type of alpha you have (see hwclock(8))\n"
-                          "\n"));
+       fprintf(usageto,
+               _("  -J|--jensen, -A|--arc, -S|--srm, -F|--funky-toy\n"
+                 "       tell hwclock the type of alpha you have (see hwclock(8))\n"
+                 "\n"));
 #endif
 
        fflush(usageto);