Date: Sun, 03 Jun 2018 15:06:19 -0700 From: Cy Schubert <Cy.Schubert@cschubert.com> To: Warner Losh <imp@bsdimp.com> Cc: Rick Macklem <rmacklem@uoguelph.ca>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org> Subject: Re: how to deal with variable set but not used warnings? Message-ID: <201806032206.w53M6Jkp095952@slippy.cwsent.com> In-Reply-To: Message from Warner Losh <imp@bsdimp.com> of "Sun, 03 Jun 2018 15:33:02 -0600." <CANCZdfryUsjsqn7izpX9BM354-9013oazxiKAz-5cSFj7m5p0A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <CANCZdfryUsjsqn7izpX9BM354-9013oazxiKAz-5cSFj7m5p0A@mail.gma il.com> , Warner Losh writes: > On Sun, Jun 3, 2018 at 3:28 PM, Rick Macklem <rmacklem@uoguelph.ca> 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.) > > > > 4. Disable the stupid warning in the Makefile / build system. If you don't > care, and there's a good reason for what you are doing (sounds like there > is), better to just disable the warning as so much useless noise. And leave a comment in the Makefile in case someone decides to re-enable the warning at some later date. -- Cheers, Cy Schubert <Cy.Schubert@cschubert.com> FreeBSD UNIX: <cy@FreeBSD.org> Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806032206.w53M6Jkp095952>