Date: Tue, 23 Jun 2020 20:15:41 -0500 From: Kyle Evans <kevans@freebsd.org> To: Jung-uk Kim <jkim@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org> Subject: Re: svn commit: r362333 - in head: contrib/flex contrib/flex/src usr.bin/lex usr.bin/lex/lib Message-ID: <CACNAnaF5MdORni5m2R7Dxn4VqQZLBxpXJzvDnG_PVc%2BNEqkbVw@mail.gmail.com> In-Reply-To: <a8f2b5c1-daed-57bf-d0a8-a9d117673d13@FreeBSD.org> References: <202006181809.05II9G8p054025@repo.freebsd.org> <CACNAnaG4AsyQhXDW%2BOBOs7iC13_8n5FaqRRg3YZk57Sow0SBcA@mail.gmail.com> <a8f2b5c1-daed-57bf-d0a8-a9d117673d13@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 23, 2020 at 8:07 PM Jung-uk Kim <jkim@freebsd.org> wrote: > > On 20. 6. 23., Kyle Evans wrote: > > On Thu, Jun 18, 2020 at 1:09 PM Jung-uk Kim <jkim@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? 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. Thanks, Kyle Evans
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaF5MdORni5m2R7Dxn4VqQZLBxpXJzvDnG_PVc%2BNEqkbVw>