Page MenuHomeFreeBSD

xo: Disable -Wunused-but-set-variable.
ClosedPublic

Authored by jhb on Jun 20 2023, 4:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 29, 3:35 AM
Unknown Object (File)
Apr 1 2024, 1:13 PM
Unknown Object (File)
Mar 13 2024, 3:50 PM
Unknown Object (File)
Mar 10 2024, 11:14 AM
Unknown Object (File)
Mar 10 2024, 10:45 AM
Unknown Object (File)
Mar 10 2024, 10:33 AM
Unknown Object (File)
Jan 18 2024, 9:04 AM
Unknown Object (File)
Dec 22 2023, 10:27 PM
Subscribers

Details

Summary

Presumably these warnings will be fixed upstream at some point.

contrib/libxo/xo/xo.c:99:9: error: variable 'hflag' set but not used [-Werror,-Wunused-but-set-variable]

int hflag = 0, jflag = 0, tflag = 0,
    ^

contrib/libxo/xo/xo.c:99:20: error: variable 'jflag' set but not used [-Werror,-Wunused-but-set-variable]

int hflag = 0, jflag = 0, tflag = 0,
               ^

contrib/libxo/xo/xo.c:99:31: error: variable 'tflag' set but not used [-Werror,-Wunused-but-set-variable]

int hflag = 0, jflag = 0, tflag = 0,
                          ^

contrib/libxo/xo/xo.c:100:2: error: variable 'zflag' set but not used [-Werror,-Wunused-but-set-variable]

zflag = 0, qflag = 0, star1 = 0, star2 = 0;
^

contrib/libxo/xo/xo.c:100:13: error: variable 'qflag' set but not used [-Werror,-Wunused-but-set-variable]

zflag = 0, qflag = 0, star1 = 0, star2 = 0;
           ^

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jun 20 2023, 4:34 PM
This revision is now accepted and ready to land.Jun 21 2023, 2:40 AM
This revision was automatically updated to reflect the committed changes.

Looks good. FWIW, the fix in the repo is in commit de776ab1a8985fbeb510af8e39777fa9db69d3d9:

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;

Thanks,
Phil