bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Silence some compiler warnings


From: Luke Allardyce
Subject: [PATCH] Silence some compiler warnings
Date: Tue, 31 May 2016 11:14:29 +0900

GCC complains about unused parameters and an ambiguous-looking if-else in getopt.c

diff --git a/getopt.c b/getopt.c
index e3538d4..1c83bf6 100644
--- a/getopt.c
+++ b/getopt.c
@@ -434,6 +434,9 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
     }
   else
     nonoption_flags_len = 0;
+#else // Silence unused params
+  (void)argc;
+  (void)argv;
 #endif
 
   return optstring;
@@ -676,7 +679,7 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
                optarg = nameend + 1;
              else
                {
-                 if (opterr)
+                 if (opterr) {
                   if (argv[optind - 1][1] == '-')
                    /* --option */
                    fprintf (stderr,
@@ -687,6 +690,7 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
                    fprintf (stderr,
                     _("%s: option '%c%s' doesn't allow an argument\n"),
                     argv[0], argv[optind - 1][0], pfound->name);
+                 }
 
                  nextchar += strlen (nextchar);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]