Opened 9 years ago
Closed 5 years ago
#8546 closed Bugs (fixed)
GCC 4.8 warns unused local typedef
| Reported by: | Owned by: | Marshall Clow | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | gil USE GITHUB |
| Version: | Boost Development Trunk | Severity: | Problem |
| Keywords: | Cc: | mateusz@… |
Description
This is a similar issue to Ticket #7242, except this affects more than one component in addition to static_assert: gcc 4.8.0 warns unused local typedefs with -Wall option added and it pertains to boost/concept/detail/general.hpp, boost/lexical_cast.hpp, boost/algorithm/string/detail/finder.hpp
In file included from /scratch/chuangw/boost/boost-trunk/boost/mpl/aux_/integral_wrapper.hpp:22:0,
from /scratch/chuangw/boost/boost-trunk/boost/mpl/int.hpp:20,
from /scratch/chuangw/boost/boost-trunk/boost/mpl/lambda_fwd.hpp:23,
from /scratch/chuangw/boost/boost-trunk/boost/mpl/aux_/na_spec.hpp:18,
from /scratch/chuangw/boost/boost-trunk/boost/mpl/if.hpp:19,
from /scratch/chuangw/boost/boost-trunk/boost/lexical_cast.hpp:37,
from /scratch/chuangw/nightlybuild/mace-fullcontext/lib/Serializable.h:45,
from /scratch/chuangw/nightlybuild/mace-fullcontext/lib/CollectionSerializers.h:34,
from /scratch/chuangw/nightlybuild/mace-fullcontext/lib/mhash_map.h:57,
from /scratch/chuangw/nightlybuild/mace-fullcontext/lib/Accumulator.h:36,
from /scratch/chuangw/nightlybuild/mace-fullcontext/lib/Scheduler.cc:31:
/scratch/chuangw/boost/boost-trunk/boost/concept_check.hpp: In function 'void boost::function_requires(Model*)':
/scratch/chuangw/boost/boost-trunk/boost/concept/detail/general.hpp:71:20: error: typedef 'boost_concept_check51' locally defined but not used [-Werror=unused-local-typedefs]
BOOST_PP_CAT(boost_concept_check,__LINE__)
^
/scratch/chuangw/boost/boost-trunk/boost/preprocessor/cat.hpp:29:34: note: in definition of macro 'BOOST_PP_CAT_I'
# define BOOST_PP_CAT_I(a, b) a ## b
^
/scratch/chuangw/boost/boost-trunk/boost/concept/detail/general.hpp:71:7: note: in expansion of macro 'BOOST_PP_CAT'
BOOST_PP_CAT(boost_concept_check,__LINE__)
^
/scratch/chuangw/boost/boost-trunk/boost/concept/assert.hpp:44:5: note: in expansion of macro 'BOOST_CONCEPT_ASSERT_FN'
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
^
/scratch/chuangw/boost/boost-trunk/boost/concept_check.hpp:51:7: note: in expansion of macro 'BOOST_CONCEPT_ASSERT'
BOOST_CONCEPT_ASSERT((Model));
^
Suggested fix: add
__attribute__((unused))
if gcc version is >= 4.8.0
Attachments (2)
Change History (16)
by , 9 years ago
comment:1 by , 9 years ago
Hi I'm suffering from the same warnings using other libraries.
Shouldn't this be included on boost/config/suffix.hpp
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) #else # define BOOST_ATTRIBUTE_UNUSED #endif
See #8549.
comment:3 by , 9 years ago
| Component: | concept_check → algorithm |
|---|---|
| Owner: | changed from to |
| Type: | Patches → Bugs |
| Version: | Boost Development Trunk → Boost 1.54.0 |
It appears 'boost/concept/detail/general.hpp' and 'boost/lexical_cast.hpp' have already been patched in the trunk.
I've recreated the patch to target the 'boost/algorithm/string/detail/finder.hpp' warnings:
finder.hpp:145 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs]
finder.hpp:266 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs]
finder.hpp:301 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs]
finder.hpp:365 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs]
finder.hpp:439 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs]
by , 9 years ago
| Attachment: | algorithm.patch added |
|---|
comment:5 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:6 by , 9 years ago
It appears [84470] was not merged to any release (yet) -- it is not present in 1.55.0 and with that release, I get errors like the following with gcc 4.8 and -Wall -Werror:
include/boost/concept_check.hpp: In function ‘void boost::function_requires(Model*)’:
include/boost/concept_check.hpp:45:113: error: typedef ‘boost_concept_check45’ locally defined but not used [-Werror=unused-local-typedefs]
BOOST_CONCEPT_ASSERT((Model));
so I think this bug may have been closed slightly prematurely.
comment:8 by , 9 years ago
| Component: | algorithm → GIL |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
| Version: | Boost 1.54.0 → Boost Development Trunk |
This applies to the new GIL currently in trunk.
comment:9 by , 7 years ago
This behaviour still persists as of now (boost 1.58.0, clang 3.6.2). Have the above patches not made it, or is there another issue?
comment:10 by , 7 years ago
This behaviour still persists as of now (boost 1.58.0, clang 3.6.2).
I will admit to having trouble following this bug's history. It started out in Boost.Algorithm, moved into Boost.Concept, (and now GIL?) and I don't really know what you are referring to when you say "this behavior still persists".
The patch for Boost.Algorithm appeared in a release a long time ago, and the patch for Boost.Concept appears to be part of the 1.59 release.
If you're having other problems, let me know - but please be specific.
comment:11 by , 7 years ago
Okay, then I'll wait for 1.59 and see if it vanishes. As of 1.58 (with clang 3.6.2 and -Wall) and the following input, I still get this "unused typedef" warning:
#include <boost/concept_check.hpp> template<typename T, typename TT> void require_type(const TT& tt) { T t = tt; (void)(t); } template<typename T1> struct UnaryMinus { T1 t; BOOST_CONCEPT_USAGE(UnaryMinus) { require_type<T1>(-t); } }; int main() { BOOST_CONCEPT_ASSERT((UnaryMinus<int>)); }
comment:12 by , 7 years ago
Okay, then I'll wait for 1.59 and see if it vanishes
Boost 1.59.0 was released three weeks ago. :-)
Using that, I get no warning with your code and clang ToT or GCC 5.1
comment:13 by , 6 years ago
| Cc: | added |
|---|
comment:14 by , 5 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
I get no warnings (with Boost 1.64.0), so I'm closing this as fixed.

patch boost/concept/detail/general.hpp, boost/lexical_cast.hpp and boost/algorithm/string/detail/finder.hpp to eliminate unused local typedefs warning