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:07:30 UTC 2020


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?

Jung-uk Kim


More information about the svn-src-head mailing list