Re: Jail compile error on CURRENT?

From: Yuri <yuri_at_aetern.org>
Date: Mon, 07 Aug 2023 23:54:46 UTC
James Gritton wrote:
> On 2023-08-07 13:29, Dimitry Andric wrote:
>> On 7 Aug 2023, at 04:50, Yoshihiro Ota <ota@j.email.ne.jp> wrote:
>>>
>>> Am I the only one seeing this error?
>>> I'm on 12.4-RELEASE amd64 and building CURRENT as of now.
>>>
>>> jaillex.c:2228:43: error: unused parameter 'yyscanner'
>>> [-Werror,-Wunused-parameter]
>>> void *yyalloc (yy_size_t  size , yyscan_t yyscanner)
>>>                                          ^
>>> jaillex.c:2233:58: error: unused parameter 'yyscanner'
>>> [-Werror,-Wunused-parameter]
>>> void *yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
>>>                                                         ^
>>> jaillex.c:2245:36: error: unused parameter 'yyscanner'
>>> [-Werror,-Wunused-parameter]
>>> void yyfree (void * ptr , yyscan_t yyscanner)
>>>                                   ^
>>> 6 errors generated.
>>> *** [jaillex.o] Error code 1
>>>
>>
>> It seems you are not crazy. :) I can reproduce the error, and I think it
>> might be caused by:
>>
>> https://cgit.freebsd.org/src/commit/?id=086e0149ae56641af245ce472e787c2f67d3aea5
>>
>> However, as to why this does not result in an error (or even a warning)
>> on -CURRENT, I have no clue. Maybe in the mean time flex in -CURRENT got
>> updated...
> 
> That is indeed the culprit.  Fortunately, it builds from 13.2-RELEASE,
> so building CURRENT from 12 can be done in two steps.  I hate to be the
> reason the update doesn't work directly, but the include capability I
> added to jail(8) requires re-entrant lex, which apparently managed to
> work around the error in 13.  They reason it doesn't give a warning BTW
> is these two lines that lex adds:
> 
>         struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
>         (void)yyg;
> 
> That makes yyscanner officially "used" even though its value is never
> actually read.  I suspect the version of lex in 12.4-RELEASE doesn't
> have one or both of those lines.
> 
> Perhaps you could add such lines to the offending functions yourself,
> and continue the make.  Or maybe build (and install) lex on its own
> first; by the time you see this error, there should already be a newer
> version of lex you could pop into place.
> 
> There's probably something I should do to make this work better, or
> perhaps some note I should put into UPDATING before 14.0 is released.

Or there is already a recipe for bootstrapping lex in Makefile.inc1,
though for somewhat older versions; possibly it could be updated for < 13?

.if ${BOOTSTRAPPING} < 1000033