Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jun 2018 21:28:47 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   how to deal with variable set but not used warnings?
Message-ID:  <YTOPR0101MB09532BCE14780B64270D07E0DD600@YTOPR0101MB0953.CANPRD01.PROD.OUTLOOK.COM>

next in thread | raw e-mail | index | archive | help
mmacy has sent me a bunch of warnings of the "variable set but not used" ki=
nd
generated by gcc8.

When I've looked at the code, these are for RPC arguments I parse but do no=
t
use at this time.
I'd  like to leave the code in place, since these arguments may be needed i=
n the
future and it is hard to figure out how to get them years from now, when th=
ey
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 n=
ot used.

So, what do others think is the preferable alternative?
(Or maybe you have a #4 that seems better than any of these.)

Thanks for your comments, rick=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTOPR0101MB09532BCE14780B64270D07E0DD600>