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)
Tue, Nov 5, 8:26 AM
Unknown Object (File)
Sun, Oct 20, 6:11 PM
Unknown Object (File)
Wed, Oct 16, 8:01 PM
Unknown Object (File)
Sep 25 2024, 2:18 PM
Unknown Object (File)
Sep 22 2024, 6:52 PM
Unknown Object (File)
Sep 19 2024, 12:36 AM
Unknown Object (File)
Sep 17 2024, 1:55 PM
Unknown Object (File)
Sep 15 2024, 4:54 AM
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