Re: [libvirt PATCH v2 01/12] glibcompat: Add G_GNUC_UNUSED to g_auto* definitions for clang

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

 



On Fri, 2021-09-10 at 14:35 +0200, Ján Tomko wrote:
> On a Friday in 2021, Tim Wiederhake wrote:
> > Workaround for a bug in clang. Clang emits an unused-variable warning
> > if the variable is only accessed on scope exit by a destructor
> > function.
> > Note that gcc does not exhibit this behavior.
> > 
> > See https://bugs.llvm.org/show_bug.cgi?id=3888 and
> > https://bugs.llvm.org/show_bug.cgi?id=43482.
> > 
> > Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> > ---
> > src/util/glibcompat.h | 19 +++++++++++++++++++
> > 1 file changed, 19 insertions(+)
> > 
> 
> https://listman.redhat.com/archives/libvir-list/2021-August/msg00863.html
> 
> Jano

>From the mail you linked:

> It's our usage that is weird here.

I disagree. I believe our usage of `g_auto*` (and in extension,
`__attribute__((cleanup))`) is exactly as this feature is meant to be
used.

> These are not needed since in all cases, the G_GNUC_UNUSED can be
> used unconditionally for both gcc and CLang in the respective macros.

That would disable unused-variable-checking for other compilers as
well, e.g. gcc, robbing us of a valuable diagnostic.

Tim




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux