Opened 9 years ago

Closed 8 years ago

#8549 closed Feature Requests (fixed)

Add a BOOST_ATTRIBUTE_UNUSED macro

Reported by: viboes Owned by: John Maddock
Milestone: To Be Determined Component: config
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

Please take a look at #8546

#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
#  define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
#else
#  define BOOST_ATTRIBUTE_UNUSED
#endif

Change History (3)

comment:1 by Neil Groves, 9 years ago

I've found this to be a general problem which has a scope across many of our Boost libraries. Having the definition in boost/concept/detail/general.hpp is not sufficient. There are cases in Boost.Tuple, Boost.Bind and my Boost.Range library. I would love to be tackling and removing these annoying warnings, but I would like to avoid duplicating the unused attribute declaration. I am currently duplicating the attribute unused idiom in Boost.Range and attempting to ignore the noise from these warnings from other libraries.

I would be happy to be assigned this defect and sort this problem out if this helps.

comment:2 by Mathias Gaunard, 8 years ago

The unused attribute has existed since the 3.x days, I suggest enabling it with 4.x variants. Even if no warning is emitted, it doesn't hurt, and it will also take care of Clang for free.

comment:3 by John Maddock, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.