The attached patch turns on more extensive warnings in gcc (-W) and then
fixes a bunch of unused-arg warnings and one signed/unsigned comparison
warning.  Non-gcc compilers should be unaffected.

This should help to find problems in the future, and will allow other
packages (such as rsync) to compile the popt code with -W w/o compiler
warnings showing up.

..wayne..
--- popt-1.14/configure 2008-02-16 16:40:56 -0800
+++ configure   2008-03-08 08:48:08 -0800
@@ -19512,7 +19512,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtoo
 
 
 if test "X$CC" = Xgcc; then
-    CFLAGS="-Wall $CFLAGS"
+    CFLAGS="-Wall -W $CFLAGS"
 fi
 
 if test $ac_cv_c_compiler_gnu = yes; then
--- popt-1.14/configure.ac      2008-02-16 16:35:13 -0800
+++ configure.ac        2008-03-08 08:47:04 -0800
@@ -21,7 +21,7 @@ AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 
 if test "X$CC" = Xgcc; then
-    CFLAGS="-Wall $CFLAGS"
+    CFLAGS="-Wall -W $CFLAGS"
 fi
 
 AC_GCC_TRADITIONAL
--- popt-1.14/popt.c    2008-03-08 08:20:20 -0800
+++ popt.c      2008-03-08 08:45:02 -0800
@@ -644,7 +644,7 @@ static void poptStripArg(/[EMAIL PROTECTED]@*/ p
 /[EMAIL PROTECTED]@*/
 }
 
-int poptSaveString(const char *** argvp, /[EMAIL PROTECTED]@*/ unsigned int 
argInfo,
+int poptSaveString(const char *** argvp, /[EMAIL PROTECTED]@*/ UNUSED(unsigned 
int argInfo),
                const char * val)
 {
     poptArgv argv;
@@ -1218,7 +1218,7 @@ poptContext poptFreeContext(poptContext 
 }
 
 int poptAddAlias(poptContext con, struct poptAlias alias,
-               /[EMAIL PROTECTED]@*/ int flags)
+               /[EMAIL PROTECTED]@*/ UNUSED(int flags))
 {
     struct poptItem_s item_buf;
     poptItem item = &item_buf;
--- popt-1.14/poptconfig.c      2008-02-16 16:35:14 -0800
+++ poptconfig.c        2008-03-08 08:46:29 -0800
@@ -170,7 +170,7 @@ int poptReadConfigFile(poptContext con, 
     return 0;
 }
 
-int poptReadDefaultConfig(poptContext con, /[EMAIL PROTECTED]@*/ int useEnv)
+int poptReadDefaultConfig(poptContext con, /[EMAIL PROTECTED]@*/ UNUSED(int 
useEnv))
 {
     static const char _popt_sysconfdir[] = POPT_SYSCONFDIR "/popt";
     static const char _popt_etc[] = "/etc/popt";
@@ -192,7 +192,7 @@ int poptReadDefaultConfig(poptContext co
         glob_t g;
 /[EMAIL PROTECTED] -nullpass -type @*/ /* FIX: annotations for glob/globfree */
        if (!glob("/etc/popt.d/*", 0, NULL, &g)) {
-            int i;
+           unsigned i;
            for (i=0; i<g.gl_pathc; i++) {
                char *f=g.gl_pathv[i];
                if (strstr(f, ".rpmnew") || strstr(f, ".rpmsave"))
--- popt-1.14/popthelp.c        2008-02-16 16:40:35 -0800
+++ popthelp.c  2008-03-08 08:45:34 -0800
@@ -34,9 +34,9 @@
  */
 /[EMAIL PROTECTED]@*/
 static void displayArgs(poptContext con,
-               /[EMAIL PROTECTED]@*/ enum poptCallbackReason foo,
+               /[EMAIL PROTECTED]@*/ UNUSED(enum poptCallbackReason foo),
                struct poptOption * key, 
-               /[EMAIL PROTECTED]@*/ const char * arg, /[EMAIL PROTECTED]@*/ 
void * data)
+               /[EMAIL PROTECTED]@*/ UNUSED(const char * arg), /[EMAIL 
PROTECTED]@*/ UNUSED(void * data))
        /[EMAIL PROTECTED] [EMAIL PROTECTED]/
        /[EMAIL PROTECTED] [EMAIL PROTECTED]/
 {
@@ -646,7 +646,7 @@ static size_t showHelpIntro(poptContext 
     return len;
 }
 
-void poptPrintHelp(poptContext con, FILE * fp, /[EMAIL PROTECTED]@*/ int flags)
+void poptPrintHelp(poptContext con, FILE * fp, /[EMAIL PROTECTED]@*/ 
UNUSED(int flags))
 {
     columns_t columns = calloc((size_t)1, sizeof(*columns));
     int xx;
@@ -865,7 +865,7 @@ static size_t showShortOptions(const str
     return len;
 }
 
-void poptPrintUsage(poptContext con, FILE * fp, /[EMAIL PROTECTED]@*/ int 
flags)
+void poptPrintUsage(poptContext con, FILE * fp, /[EMAIL PROTECTED]@*/ 
UNUSED(int flags))
 {
     columns_t columns = calloc((size_t)1, sizeof(*columns));
     struct poptDone_s done_buf;
--- popt-1.14/poptparse.c       2008-02-16 16:35:14 -0800
+++ poptparse.c 2008-03-08 08:43:27 -0800
@@ -126,7 +126,7 @@ exit:
  * 2== line to long
  * 3== umm.... more?
  */
-int poptConfigFileToString(FILE *fp, char ** argstrp, /[EMAIL PROTECTED]@*/ 
int flags)
+int poptConfigFileToString(FILE *fp, char ** argstrp, /[EMAIL PROTECTED]@*/ 
UNUSED(int flags))
 {
     char line[999];
     char * argstr;
--- popt-1.14/system.h  2007-11-04 06:41:03 -0800
+++ system.h    2008-03-08 08:40:29 -0800
@@ -82,4 +82,9 @@ char * xstrdup (const char *str)
 #define        getenv(_s)      __secure_getenv(_s)
 #endif
 
+#ifndef __GNUC__
+#define __attribute__(x) 
+#endif
+#define UNUSED(x) x __attribute__((__unused__))
+
 #include "popt.h"
--- popt-1.14/test1.c   2008-02-16 16:42:08 -0800
+++ test1.c     2008-03-08 08:45:02 -0800
@@ -6,8 +6,8 @@
 
 /[EMAIL PROTECTED]@*/
 static int pass2 = 0;
-static void option_callback(/[EMAIL PROTECTED]@*/ poptContext con,
-               /[EMAIL PROTECTED]@*/ enum poptCallbackReason reason,
+static void option_callback(/[EMAIL PROTECTED]@*/ UNUSED(poptContext con),
+               /[EMAIL PROTECTED]@*/ UNUSED(enum poptCallbackReason reason),
                const struct poptOption * opt,
                char * arg, void * data)
        /[EMAIL PROTECTED] fileSystem @*/

Reply via email to