From owner-svn-src-all@freebsd.org Wed Jun 24 01:15:53 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD6F233F3B1; Wed, 24 Jun 2020 01:15:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49s4w94MB9z4NcN; Wed, 24 Jun 2020 01:15:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 8B3D11ADAF; Wed, 24 Jun 2020 01:15:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f177.google.com with SMTP id c139so363151qkg.12; Tue, 23 Jun 2020 18:15:53 -0700 (PDT) X-Gm-Message-State: AOAM533Zp3HMU+hApSQn0Vl9xB8Q15czuuEevxdTBlupztpQ5eHHMjGy W9jdLs/u3F8uun/NP25DbHmVw2Nv+gml1jjF+3M= X-Google-Smtp-Source: ABdhPJypN9Q9Oz7z/Uq1taxFSapUNAYcXGTaAPdoJqnpG/mEQw2riF2lhG3M9A4f/S4dspWs42b5W5GIU0vNmY4qe4k= X-Received: by 2002:a05:620a:218e:: with SMTP id g14mr6568463qka.430.1592961353092; Tue, 23 Jun 2020 18:15:53 -0700 (PDT) MIME-Version: 1.0 References: <202006181809.05II9G8p054025@repo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Tue, 23 Jun 2020 20:15:41 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r362333 - in head: contrib/flex contrib/flex/src usr.bin/lex usr.bin/lex/lib To: Jung-uk Kim Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2020 01:15:53 -0000 On Tue, Jun 23, 2020 at 8:07 PM Jung-uk Kim wrote: > > On 20. 6. 23., Kyle Evans wrote: > > On Thu, Jun 18, 2020 at 1:09 PM Jung-uk Kim 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