Opened 10 years ago

Closed 3 years ago

#7434 closed Bugs (wontfix)

Lock used in flyweight causes erroneous "unused variable" warning when compiling with clang

Reported by: Pierre Imai <pierre.imai@…> Owned by: Joaquín M López Muñoz
Milestone: To Be Determined Component: flyweight
Version: Boost 1.51.0 Severity: Problem
Keywords: clang unused variable warning Cc:

Description

The lock functionality in boost/flyweight/detail/flyweight_core.hpp causes the following warning when compiled with "Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)" with option "-Wunused-variable":

In file included from /opt/local/include/boost/flyweight/flyweight.hpp:22:
/opt/local/include/boost/flyweight/detail/flyweight_core.hpp:189:22: error: unused variable 'lock' [-Werror,-Wunused-variable]
    lock_type        lock(mutex());

This problem can be fixed by adding the following code to the file, before / after the corresponding blocks for MSVC

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif

Change History (2)

comment:1 by Joaquín M López Muñoz, 9 years ago

Hi Pierre,

Can you provide me with two bits of additional info?

  • Can you check the values of clang_major and clang_minor? I'd like make the patch using BOOST_WORKAROUND and BOOST_TESTED_AT so as to record the specific version of Clang where this is happening.
  • Do you have access to GCC in your environment? Does the equivalent warning happen?

Thank you,

comment:2 by Joaquín M López Muñoz, 3 years ago

Resolution: wontfix
Status: newclosed

Can't fix due to lack of feedback from reporter.

Note: See TracTickets for help on using tickets.