lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Is '-Wno-unused-variable' still needed?


From: Vadim Zeitlin
Subject: Re: [lmi] Is '-Wno-unused-variable' still needed?
Date: Sun, 24 Oct 2021 23:37:44 +0200

On Fri, 22 Oct 2021 15:12:52 +0000 Greg Chicares <gchicares@sbcglobal.net> 
wrote:

GC> While inspecting some recent changes, I saw that 'configure.ac' today
GC> contains:
GC> 
GC>     dnl This warning is now only given for 2 variables in 
ledger_evaluator.cpp
GC>     dnl and should be fixed there and reenabled.
GC>     LMI_CXX_ADD_IF_SUPPORTED(-Wno-unused-variable)
GC> 
GC> It looks like you added those "dnl" comments in commit 5112db4dcfcfe,
GC> about two weeks ago, so I suppose you've seen unused-variable warnings
GC> in an autotools build. But I see no such warnings in builds using
GC> lmi's makefiles. Why would there be a difference? AFAICT, '-Wall'
GC> should enable '-Wunused-variable', and I'm not turning it off.

 Sorry, I should have mentioned this in my original email that I've finally
resent today, but the difference is that I've seen this warning only with
clang, not gcc:

---------------------------------- >8 --------------------------------------
ledger_evaluator.cpp:690:39: error: unused variable 'f4' 
[-Werror,-Wunused-variable]
    std::pair<int,oenum_format_style> f4(2, oe_format_percentage);
                                      ^
ledger_evaluator.cpp:688:39: error: unused variable 'f2' 
[-Werror,-Wunused-variable]
    std::pair<int,oenum_format_style> f2(2, oe_format_normal);
                                      ^
2 errors generated.
---------------------------------- >8 --------------------------------------

 I can't get this warning with gcc for whatever reason, perhaps it
considers that std::pair ctor has side effects (but it doesn't, really, and
clang gives this warning even when using libstdc++ and not its own libc++).
But the warning does look justified and it seems that it's a (minor) gcc
bug that it doesn't give it.

 I'm not sure if I should move this LMI_CXX_ADD_IF_SUPPORTED() to
clang-only section of configure or if we could fix it, even for clang, and
then just delete this line. If you don't think it's worth spending time on
fixing it, I'll at least disable it for clang only and leave it enabled for
gcc.

 Sorry for forgetting yet another thing...
VZ

Attachment: pgpFR4Fnq0fbW.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]