svn commit: r362333 - in head: contrib/flex contrib/flex/src usr.bin/lex usr.bin/lex/lib

Jung-uk Kim jkim at FreeBSD.org
Wed Jun 24 01:49:19 UTC 2020


On 20. 6. 23., Kyle Evans wrote:
> On Tue, Jun 23, 2020 at 8:07 PM Jung-uk Kim <jkim at freebsd.org> wrote:
>>
>> On 20. 6. 23., Kyle Evans wrote:
>>> On Thu, Jun 18, 2020 at 1:09 PM Jung-uk Kim <jkim at freebsd.org> wrote:
>>>>
>>>> Author: jkim
>>>> Date: Thu Jun 18 18:09:16 2020
>>>> New Revision: 362333
>>>> URL: https://svnweb.freebsd.org/changeset/base/362333
>>>>
>>>> Log:
>>>>   MFV:  r362286
>>>>
>>>>   Merge flex 2.6.4.
>>>>
>>>
>>> Hi,
>>>
>>> I'm looking at getting amd64 world buildable again by gcc6; this seems
>>> to give it some gas:
>>>
>>> /usr/src/contrib/flex/src/main.c: In function 'check_options':
>>> /usr/src/contrib/flex/src/main.c:347:14: error: assignment discards
>>> 'const' qualifier from pointer target type
>>> [-Werror=discarded-qualifiers]
>>>    if ((slash = strrchr(M4, '/')) != NULL) {
>>>
>>> The following trivial patch seems to make gcc6 happy again.
>>>
>>> diff --git a/contrib/flex/src/main.c b/contrib/flex/src/main.c
>>> index 711e387b1b5..97e043c6275 100644
>>> --- a/contrib/flex/src/main.c
>>> +++ b/contrib/flex/src/main.c
>>> @@ -342,7 +342,7 @@ void check_options (void)
>>>      /* Setup the filter chain. */
>>>      output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
>>>      if ( !(m4 = getenv("M4"))) {
>>> -           char *slash;
>>> +           const char *slash;
>>>                 m4 = M4;
>>>                 if ((slash = strrchr(M4, '/')) != NULL) {
>>>                         m4 = slash+1;
>>
>> Hmm...  It looks like a false positive and I am little reluctant to
>> change the vendor code.
>>
>> Can you just add "-Wno-discarded-qualifiers" or something to
>> CWARNFLAGS.gcc in share/mk/bsd.sys.mk for some WARNS level?
>>
> 
> Do we not have a working relationship with an upstream on this one to
> sort it out?

Not really.  You may file an issue or a pull request but I don't see
much activity from the author recently.

https://github.com/westes/flex

Jung-uk Kim

> It's debatably correct; M4 is effectively a const string (string
> literal, as far as I can tell) and strrchr promises a little more than
> it should because we really shouldn't mutate the result in that kind
> of scenario. In this case, the result isn't mutated, but it certainly
> looks like it could be with the current declaration of slash.


More information about the svn-src-all mailing list