libxo icon indicating copy to clipboard operation
libxo copied to clipboard

xo/xo.c#L99: add missing UNUSED marker for all unused flags

Open pstef opened this issue 2 years ago • 2 comments

int lflag UNUSED = 0;
int hflag = 0, jflag = 0, tflag = 0,
zflag = 0, qflag = 0,

are all set but not used, however only lflag is marked as such. Compilers complain :(

pstef avatar Mar 17 '22 22:03 pstef

Yup, there are all ignored and should be marked as such. Here’s a patch:

diff --git a/xo/xo.c b/xo/xo.c index 6d45c9c..e682cbf 100644 --- a/xo/xo.c +++ b/xo/xo.c @@ -95,9 +95,10 @@ static xo_ssize_t formatter (xo_handle_t *xop, char *buf, xo_ssize_t bufsiz, const char *fmt, va_list vap UNUSED) {

  • int lflag UNUSED = 0; /* Parse long flag, though currently ignored */
  • int hflag = 0, jflag = 0, tflag = 0,
  • zflag = 0, qflag = 0, star1 = 0, star2 = 0;
  • /* printf-style formatting flags, currently ignored */
  • int lflag UNUSED = 0, hflag UNUSED = 0, jflag UNUSED = 0,
  • tflag UNUSED = 0, zflag UNUSED = 0, qflag UNUSED = 0;
  • int star1 = 0, star2 = 0; int rc = 0; int w1 = 0, w2 = 0; const char *cp;

Could you please let me know the compiler/version that is failing?

Thanks, Phil

On Mar 17, 2022, at 6:33 PM, pstef @.***> wrote:

int lflag UNUSED = 0; int hflag = 0, jflag = 0, tflag = 0, zflag = 0, qflag = 0, are all set but not used, however only lflag is marked as such. Compilers complain :(

— Reply to this email directly, view it on GitHub https://github.com/Juniper/libxo/issues/85, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAROIOGGHJ6LV3RFIJN3VXDVAOXMXANCNFSM5RAG5KSQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.

philshafer avatar Mar 18 '22 22:03 philshafer

The patch looks good to me, but I didn't test it. Sorry, I didn't mean to suggest that a compiler is failing. clang/llvm 13 was recently imported into base and by default it warns about variables set but not used.

pstef avatar Mar 18 '22 23:03 pstef