bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] argp: fix HAVE_DECL usage error


From: Eric Blake
Subject: Re: [PATCH] argp: fix HAVE_DECL usage error
Date: Fri, 13 Jul 2012 12:18:19 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 07/13/2012 12:04 PM, Paul Eggert wrote:
> On 07/13/2012 10:53 AM, Eric Blake wrote:
>> 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.
> 
> But those HAVE_DECL_ macros are not set by AC_CHECK_DECLS_ONCE.

Indeed; looking at m4/argp.m4:

AC_DEFUN([gl_ARGP],
[
  AC_REQUIRE([AC_C_INLINE])
  AC_REQUIRE([AC_C_RESTRICT])
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])

  AC_CHECK_DECL([program_invocation_name],
                [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_NAME], [1],
                           [Define if program_invocation_name is
declared])],
                [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1],
                           [Define to 1 to add extern declaration of
program_invocation_name to argp.h])],
                [[#include <errno.h>]])
  AC_CHECK_DECL([program_invocation_short_name],
...

they are set by actually using the action-if-found/action-if-not-found
arguments of AC_CHECK_DECL, rather than the more typical use of
AC_CHECK_DECLS.

> 
> I don't think the change broke anything, but it wasn't needed.

Hence, I asked for a review instead of pushing.

> That being said, I suggest also changing gl_ARGP so that
> it sets thos HAVE_DECL_ macros to 0 or 1, rather than to undefined
> or 1, to be compatible with the usual style in gnulib.

Agreed; v2 coming up.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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