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);