bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-argmatch: fix a link failure


From: Bruno Haible
Subject: Re: test-argmatch: fix a link failure
Date: Wed, 14 Nov 2007 13:19:41 +0100
User-agent: KMail/1.5.4

Jim Meyering wrote:
> this doesn't work, either.
> The trouble is that the argmatch code being linked against
> is that from the library, and for coreutils, that module
> includes references to usage, so an #undef here doesn't change anything.

Oops, I admit I did not test the modification.

> 3 disallow use of "extern" in ARGMATCH_DIE_DECL,
>   and simply add this line to test-argmatch.c:
> 
>   ARGMATCH_DIE_DECL { exit (1); }
> 
> I prefer #3.

I prefer that too. It looks bizarre, but this is because the way the
argmatch module is customized from outside is bizarre.

> Here's the proposed gnulib change:
> 
> diff --git a/tests/test-argmatch.c b/tests/test-argmatch.c
> index f6126f6..ebba8b7 100644
> --- a/tests/test-argmatch.c
> +++ b/tests/test-argmatch.c
> @@ -19,9 +19,11 @@
> 
>  #include <config.h>
> 
> -/* Some packages define ARGMATCH_DIE in their <config.h>.  Here we want to
> -   assume the default definition of ARGMATCH_DIE.  */
> -#undef ARGMATCH_DIE
> +/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
> +   thus must link with a definition of that function.  Provide it here.  */
> +#ifdef ARGMATCH_DIE_DECL
> +ARGMATCH_DIE_DECL { exit (1); }
> +#endif
> 
>  #include "argmatch.h"

Yes. I would now move this paragraph after the #includes (since it does not
not need to be before #include "argmatch.h" any more).

Bruno





reply via email to

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