bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] argp: fix HAVE_DECL usage error


From: Eric Blake
Subject: [PATCH] argp: fix HAVE_DECL usage error
Date: Fri, 13 Jul 2012 11:53:45 -0600

Autoconf guarantees that AC_CHECK_DECLS_ONCE always defines the
corresponding HAVE_DECL_*, so checking #ifndef HAVE_DECL_* is bogus.
https://lists.gnu.org/archive/html/coreutils/2012-06/msg00037.html

* lib/argp-parse.c (__argp_parse): Check contents of HAVE_DECL
macros, not whether they are defined.
Reported by Karel Zak.
---

argp is not my module, so I'll wait a couple days to see if Sergey
has any comments before I push this.

 ChangeLog        |    5 +++++
 lib/argp-parse.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a35ea2f..17075dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-07-13  Eric Blake  <address@hidden>

+       argp: fix HAVE_DECL usage error
+       * lib/argp-parse.c (__argp_parse): Check contents of HAVE_DECL
+       macros, not whether they are defined.
+       Reported by Karel Zak.
+
        strndup: fix m4 usage error
        * m4/strndup.m4 (gl_FUNC_STRNDUP): HAVE_DECL_STRNDUP is always
        defined, to either 0 or 1.
diff --git a/lib/argp-parse.c b/lib/argp-parse.c
index 3b411d4..6bbb145 100644
--- a/lib/argp-parse.c
+++ b/lib/argp-parse.c
@@ -880,11 +880,11 @@ __argp_parse (const struct argp *argp, int argc, char 
**argv, unsigned flags,
 #ifndef _LIBC
   if (!(flags & ARGP_PARSE_ARGV0))
     {
-#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME
+#if HAVE_DECL_PROGRAM_INVOCATION_NAME
       if (!program_invocation_name)
         program_invocation_name = argv[0];
 #endif
-#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
       if (!program_invocation_short_name)
         program_invocation_short_name = __argp_base_name (argv[0]);
 #endif
-- 
1.7.10.4




reply via email to

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