autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Revert 'Fix logic error in _AC_PROG_LEX_YYTEXT_DECL (#109320


From: Ross Burton
Subject: Re: [PATCH] Revert 'Fix logic error in _AC_PROG_LEX_YYTEXT_DECL (#109320)'
Date: Thu, 16 Jul 2020 15:19:26 +0100

On Thu, 16 Jul 2020 at 15:10, Zack Weinberg <zackw@panix.com> wrote:
> I presume that gdbm, flex, and gmp provide a definition of yywrap
> themselves, so they don't actually *need* lib{,f}l.a.

gmp calclex.l:
yywrap ()
{
  return 1;
}

flex scan.l:
int yywrap(void)
        {
        if ( --num_input_files > 0 )
                {
                set_input_file( *++input_files );
                return 0;
                }

        else
                return 1;
        }

bc scan.l:
yywrap(void)
{
  if (!open_new_file ()) return (1);    /* EOF on standard in. */
  return (0);                           /* We have more input. */
  yyunput(0,NULL);      /* Make sure the compiler think yyunput is used. */
}

Yes, they provide their own.

> Clearly we need to preserve compatibility with these existing autoconf
> scripts, and I would guess that programs that define yywrap themselves
> are much more common than those that use the fallback, which is not
> that useful (all it does is return 1, causing the scanner to stop).  I
> propose to make the following additional changes, instead of reverting
> the patch:
>
>  - Change the conftest.l used by _AC_PROG_LEX_YYTEXT_DECL so that it
> defines yywrap itself (it already defines main).  Thus, LEXLIB will
> only be set to -ll or -lfl if there's something in there *besides*
> yywrap and main that the generated scanner needs.  Document this.
>
>  - Add a new macro, tentatively AC_FUNC_YYWRAP([action-if-not-found]),
> that tries to find a definition of yywrap in libl and libfl, sets
> LEXLIB accordingly, and failing that executes action-if-not-found,
> which defaults to AC_LIBOBJ([yywrap]).

The first change seems entirely correct. Is the second actually needed?

Ross



reply via email to

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