From owner-svn-src-all@freebsd.org Thu May 24 15:58:14 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97221EF631C for ; Thu, 24 May 2018 15:58:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23D377485E for ; Thu, 24 May 2018 15:58:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x243.google.com with SMTP id z5-v6so407551iob.8 for ; Thu, 24 May 2018 08:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=lIjHncLEdGVQHMDaaGSORR5m9qycmpQk2OOvkuNQrKo=; b=OkyHVYpKcamVfi/3+kWnAp6bqdYDyb7AQVuuPhDZg+k/Bv6oDwHPrGMYunWCU9+lpr Tj6J3T/oewfF8g/nABL67y8YzO24ChV/ihYFG4N87ePEymg9j3fm4bX1fcs/tTsr1r/E kKZcrrSSuIwBTrC2b9tJ4excco1oZphRCq9ySw9nfN422KnpIw6AcwhjfpiFsVeFu3LM czB9SbVvmSeU1ck355gBdgdVGA/ZURtjxWv9Nxulq6xRk0zfgaZIuYudjEYFagQq1bmQ xHqFKRM9EPxC2zLBFoyeUm246TMOL63N3WK5trTZCOkqoGqw36x7mu8VcNQd/DIfXhVA RzWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=lIjHncLEdGVQHMDaaGSORR5m9qycmpQk2OOvkuNQrKo=; b=h7pmdPrC2kS+0hjdBaN0JSY52iGozw5K1NuVIZ2zfv+aBMxwS2yMpKQDjtGRyEJPD2 ObnJIlkOw69pUsknGDSbc/MVpXafzTR/S39kL8DWjsd7OatYIm4wlczBQbzyaTck4bIl VM16QhNvGNGm5EL6Rt02vvZmDtZJsXuO/LklHBxn20v8dYBACuZcbObJAtAwJal8ESip UHqavDpmIc+YwWqvZb7oTYgViwwgfR35TvhSPPs0BLMqGVCLOTUGPTdcvOqAypb38WNT 9oLSlBxMghzs/B/zYxBwhWewPistUgl5nz/dmPvPftVh4pdrUeHQWp3JxLJzeKZggtSh Nm+Q== X-Gm-Message-State: ALKqPwdVRkR+wHoILxWEXeufGyiLWffGjKMe9hjGnTVpdFbtvhbDL4R3 ARTK04dbOTYL782EWvdgwsK8kEqcn1KpdUNOqEmyFw== X-Google-Smtp-Source: ADUXVKJysdfQfpFl9NkN+6LELWxtiNtTyfUy0ghglTX9vh8j1D2XHZCB+SaxCGuyYj6cjmyAf4epyIaUPJUKVnqqQjE= X-Received: by 2002:a6b:5a0d:: with SMTP id o13-v6mr7185100iob.39.1527177493458; Thu, 24 May 2018 08:58:13 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Thu, 24 May 2018 08:58:12 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201805190510.w4J5AqfS054367@repo.freebsd.org> <20180523222743.GU71675@FreeBSD.org> <20180523225729.GV71675@FreeBSD.org> <20180524044252.GW71675@FreeBSD.org> <5B9EE208-384F-44AD-9B47-059D77FE9B34@macmic.franken.de> From: Warner Losh Date: Thu, 24 May 2018 09:58:12 -0600 X-Google-Sender-Auth: ILXSzuMLQv1qiY0EUYL0vqHw60w Message-ID: Subject: Re: svn commit: r333860 - head/sys/kern To: Matthew Macy Cc: Michael Tuexen , Gleb Smirnoff , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 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: Thu, 24 May 2018 15:58:14 -0000 On Thu, May 24, 2018 at 12:53 AM, Matthew Macy wrote: > On Wed, May 23, 2018 at 11:42 PM, Michael Tuexen > wrote: > >> On 24. May 2018, at 08:36, Matthew Macy wrote: > >> > >> On Wed, May 23, 2018 at 11:35 PM, Michael Tuexen > >> wrote: > >>>> On 24. May 2018, at 06:51, Matthew Macy wrote: > >>>> > >>>> Warnings find bugs PERIOD. Although most are not useful, I've found > >>> Some warnings indicate bugs, some warnings are just wrong. If you > >>> have a "may be used uninitialized" warning being a false positive, you > >>> may silences the warning by just set it to zero in the declaration and > >>> you silence it. Other compilers might then correctly report an > >>> assignment without affect... > >> > >> I have yet to see a double assignment be flagged as assignment without > >> effect. If it _does_ occur then we have to disable the warning on the > >> compiler that we have less faith in. > > Have seen it in the past in a difference project... But you miss my > point: > > > > Not all warnings indicate bugs PERIOD. Some warning are just wrong... > > Have you read my follow up? _Many_ Many warnings are wrong. Please > respond to that on what the global policy should be. The value of any > one particular instance of a warning does not merit discussion. > The global policy has never been 'fix all warnings no matter what.' It's been 'Look at the warning. If it's a false positive, use judgement about whether or not to stifle the compiler.' There are cases I've run into that it was impossible to silence the warnings (apart form adding command line stuff) for a particular bit of code. Do it one way gcc 4.2 complains. Do it another clang complains. appease both and gcc 6 had heart-burn. So don't gratuitously commit code that fixes warnings on gcc 8. If the warning points out a legitimate bug, then that's no brainer yes. If it's a false positive, then it's less clear and often times many factors may need to be weighed. Warner > -M > > > > > > > > > > > > , in this case the assignment should be added with > >>>>> a comment /* pacify gcc */. > >>>>> > >>>>> On Wed, May 23, 2018 at 03:59:33PM -0700, Matthew Macy wrote: > >>>>> M> On Wed, May 23, 2018 at 3:57 PM, Gleb Smirnoff < > glebius@freebsd.org> wrote: > >>>>> M> > The initialization isn't useful. > >>>>> M> > >>>>> M> It silences a gcc warning. So yes it is. It's this exchange which > is not useful. > >>>>> M> > >>>>> M> -M > >>>>> M> > >>>>> M> > >>>>> M> > On Wed, May 23, 2018 at 03:52:42PM -0700, Matthew Macy wrote: > >>>>> M> > M> Talk to the gcc devs. The warning is useful even if there > are false positives. > >>>>> M> > M> > >>>>> M> > M> On Wed, May 23, 2018 at 3:27 PM, Gleb Smirnoff < > glebius@freebsd.org> wrote: > >>>>> M> > M> > Hi, > >>>>> M> > M> > > >>>>> M> > M> > On Sat, May 19, 2018 at 05:10:52AM +0000, Matt Macy wrote: > >>>>> M> > M> > M> Author: mmacy > >>>>> M> > M> > M> Date: Sat May 19 05:10:51 2018 > >>>>> M> > M> > M> New Revision: 333860 > >>>>> M> > M> > M> URL: https://svnweb.freebsd.org/changeset/base/333860 > >>>>> M> > M> > M> > >>>>> M> > M> > M> Log: > >>>>> M> > M> > M> sendfile: annotate unused value and ensure that > npages is actually initialized > >>>>> M> > M> > M> > >>>>> M> > M> > M> Modified: > >>>>> M> > M> > M> head/sys/kern/kern_sendfile.c > >>>>> M> > M> > M> > >>>>> M> > M> > M> Modified: head/sys/kern/kern_sendfile.c > >>>>> M> > M> > M> ============================== > ================================================ > >>>>> M> > M> > M> --- head/sys/kern/kern_sendfile.c Sat May 19 > 05:09:10 2018 (r333859) > >>>>> M> > M> > M> +++ head/sys/kern/kern_sendfile.c Sat May 19 > 05:10:51 2018 (r333860) > >>>>> M> > M> > M> @@ -341,7 +341,7 @@ sendfile_swapin(vm_object_t obj, > struct sf_io *sfio, o > >>>>> M> > M> > M> } > >>>>> M> > M> > M> > >>>>> M> > M> > M> for (int i = 0; i < npages;) { > >>>>> M> > M> > M> - int j, a, count, rv; > >>>>> M> > M> > M> + int j, a, count, rv __unused; > >>>>> M> > M> > M> > >>>>> M> > M> > M> /* Skip valid pages. */ > >>>>> M> > M> > M> if (vm_page_is_valid(pa[i], vmoff(i, off) > & PAGE_MASK, > >>>>> M> > M> > M> @@ -688,6 +688,7 @@ retry_space: > >>>>> M> > M> > M> if (space == 0) { > >>>>> M> > M> > M> sfio = NULL; > >>>>> M> > M> > M> nios = 0; > >>>>> M> > M> > M> + npages = 0; > >>>>> M> > M> > M> goto prepend_header; > >>>>> M> > M> > M> } > >>>>> M> > M> > M> hdr_uio = NULL; > >>>>> M> > M> > > >>>>> M> > M> > This initialization is redundant and a compiler warning if > exists is wrong. > >>>>> M> > M> > > >>>>> M> > M> > If we jump down to prepend_header with nios == 0, we won't > ever use npages. > >>>>> M> > M> > > >>>>> M> > M> > -- > >>>>> M> > M> > Gleb Smirnoff > >>>>> M> > > >>>>> M> > -- > >>>>> M> > Gleb Smirnoff > >>>>> > >>>>> -- > >>>>> Gleb Smirnoff > >>>> > >>> > > > >