Juniper / libxo

The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced.
http://juniper.github.io/libxo/libxo-manual.html
BSD 2-Clause "Simplified" License
321 stars 48 forks source link

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

Open pstef opened 2 years ago

pstef commented 2 years ago
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 :(

philshafer commented 2 years ago

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) {

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.

pstef commented 2 years ago

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.