bug-gnulib
[Top][All Lists]
Advanced

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

Re: warnings in 'argp' module


From: Sergey Poznyakoff
Subject: Re: warnings in 'argp' module
Date: Sat, 21 Jan 2006 21:16:20 EET

Bruno Haible <address@hidden> wrote:

> The argp module has warnings on Linux/glibc:

I have installed the following patch:

2006-01-21  Sergey Poznyakoff  <address@hidden>

        * lib/argp-help.c (usage_long_opt): Do not print DOC options.
        (__argp_base_name): Removed
        * lib/argp-namefrob.h (__argp_basename): Removed definition. Was a
        typo.
        (__argp_base_name): Provide macro definition or extern declaration
        depending on the configuration
        * modules/argp-tests: New module
        * tests/test-argp.c: New file
        * tests/test-argp-2.sh: New file


Index: lib/argp-help.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-help.c,v
retrieving revision 1.20
diff -p -u -r1.20 argp-help.c
--- lib/argp-help.c     10 Dec 2005 21:37:29 -0000      1.20
+++ lib/argp-help.c     21 Jan 2006 19:00:35 -0000
@@ -50,7 +50,6 @@
 #include "argp.h"
 #include "argp-fmtstream.h"
 #include "argp-namefrob.h"
-#include "dirname.h"
 
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
@@ -1305,7 +1304,7 @@ usage_long_opt (const struct argp_option
   if (! arg)
     arg = real->arg;
 
-  if (! (flags & OPTION_NO_USAGE))
+  if (! (flags & OPTION_NO_USAGE) && !odoc (opt))
     {
       if (arg)
        {
@@ -1714,15 +1713,6 @@ void __argp_help (const struct argp *arg
 weak_alias (__argp_help, argp_help)
 #endif
 
-char *
-__argp_base_name (char *name)
-{
-  char *p;
-  for (p = name + strlen (name); p > name && !ISSLASH (p[-1]); p--)
-    ;
-  return p;
-}
-     
 #if ! (defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME)
 char *
 __argp_short_program_name (void)
Index: lib/argp-namefrob.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-namefrob.h,v
retrieving revision 1.9
diff -p -u -r1.9 argp-namefrob.h
--- lib/argp-namefrob.h 12 Dec 2005 14:12:08 -0000      1.9
+++ lib/argp-namefrob.h 21 Jan 2006 19:00:36 -0000
@@ -141,14 +141,21 @@
 # define putchar_unlocked(x) putchar (x)
 # endif
 
-extern char *__argp_basename (char *name);
-
 #endif /* !_LIBC */
 
 #ifndef __set_errno
 #define __set_errno(e) (errno = (e))
 #endif
 
+#if defined GNULIB_ARGP_DISABLE_DIRNAME
+# define __argp_base_name(arg) arg
+#elif defined GNULIB_ARGP_EXTERN_BASENAME
+# extern char *__argp_base_name(const char *arg);
+#else
+# include "dirname.h"
+# define __argp_base_name base_name
+#endif
+
 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
 # define __argp_short_program_name()   (program_invocation_short_name)
 #else


Regards,
Sergey
 




reply via email to

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