From owner-freebsd-current@freebsd.org Sun Jun 3 22:20:02 2018 Return-Path: Delivered-To: freebsd-current@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 5A74AFE4CF0 for ; Sun, 3 Jun 2018 22:20:02 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E0EEE808D9 for ; Sun, 3 Jun 2018 22:20:01 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w53MJtFj046000 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 3 Jun 2018 15:19:55 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w53MJtmK045999; Sun, 3 Jun 2018 15:19:55 -0700 (PDT) (envelope-from sgk) Date: Sun, 3 Jun 2018 15:19:55 -0700 From: Steve Kargl To: Rick Macklem Cc: "freebsd-current@freebsd.org" Subject: Re: how to deal with variable set but not used warnings? Message-ID: <20180603221955.GA45990@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2018 22:20:02 -0000 On Sun, Jun 03, 2018 at 09:28:47PM +0000, Rick Macklem wrote: > mmacy has sent me a bunch of warnings of the "variable set but not used" kind > generated by gcc8. > > When I've looked at the code, these are for RPC arguments I parse but do not > use at this time. > I'd like to leave the code in place, since these arguments may be needed in the > future and it is hard to figure out how to get them years from now, when they > might be needed. > I can think of 3 ways to handle this: > 1 - Get rid of the code. (As above, I'd rather not do this.) > 2 - Wrap the code with "#if 0"/"#endif" or similar. I'll admit that I find this rather > ugly and tends to make the code harder to follow. > 3 - Leave the code and add a comment w.r.t. why the variables are set but not used. > > So, what do others think is the preferable alternative? > (Or maybe you have a #4 that seems better than any of these.) > CFLAGS+=-Wno-unused -- Steve