Boost C++ Libraries: Ticket #8546: GCC 4.8 warns unused local typedef https://svn.boost.org/trac10/ticket/8546 <p> This is a similar issue to Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7242" title="#7242: Bugs: GCC 4.8 warns unused local typedef (closed: fixed)">#7242</a>, 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 </p> <pre class="wiki">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)); ^ </pre><p> Suggested fix: add </p> <pre class="wiki">__attribute__((unused)) </pre><blockquote> <p> if gcc version is &gt;= 4.8.0 </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8546 Trac 1.4.3 Wei-Chiu Chuang <weichiu@…> Sat, 04 May 2013 05:00:18 GMT attachment set https://svn.boost.org/trac10/ticket/8546 https://svn.boost.org/trac10/ticket/8546 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">diff1</span> </li> </ul> <p> patch boost/concept/detail/general.hpp, boost/lexical_cast.hpp and boost/algorithm/string/detail/finder.hpp to eliminate unused local typedefs warning </p> Ticket viboes Sat, 04 May 2013 09:29:11 GMT <link>https://svn.boost.org/trac10/ticket/8546#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:1</guid> <description> <p> Hi I'm suffering from the same warnings using other libraries. </p> <p> Shouldn't this be included on boost/config/suffix.hpp </p> <pre class="wiki">#if defined(__GNUC__) &amp;&amp; ((__GNUC__ &gt; 4) || ((__GNUC__ == 4) &amp;&amp; (__GNUC_MINOR__ &gt;= 7))) # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) #else # define BOOST_ATTRIBUTE_UNUSED #endif </pre><p> See <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8549" title="#8549: Feature Requests: Add a BOOST_ATTRIBUTE_UNUSED macro (closed: fixed)">#8549</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 07 Jul 2013 16:55:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8546#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:2</guid> <description> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/84470" title="Added unused attribute for new versions of GCC">[84470]</a> is related to this. Could this be closed? </p> </description> <category>Ticket</category> </item> <item> <author>Chris Stylianou <chris5287@…></author> <pubDate>Thu, 18 Jul 2013 20:31:22 GMT</pubDate> <title>owner, type, version, component changed https://svn.boost.org/trac10/ticket/8546#comment:3 https://svn.boost.org/trac10/ticket/8546#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jsiek</span> to <span class="trac-author">Marshall Clow</span> </li> <li><strong>type</strong> <span class="trac-field-old">Patches</span> → <span class="trac-field-new">Bugs</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.54.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">concept_check</span> → <span class="trac-field-new">algorithm</span> </li> </ul> <p> It appears 'boost/concept/detail/general.hpp' and 'boost/lexical_cast.hpp' have already been patched in the trunk. </p> <p> I've recreated the patch to target the 'boost/algorithm/string/detail/finder.hpp' warnings: </p> <pre class="wiki">finder.hpp:145 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs] </pre><pre class="wiki">finder.hpp:266 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs] </pre><pre class="wiki">finder.hpp:301 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs] </pre><pre class="wiki">finder.hpp:365 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs] </pre><pre class="wiki">finder.hpp:439 typedef ‘input_iterator_type’ locally defined but not used [-Wunused-local-typedefs] </pre> Ticket Chris Stylianou <chris5287@…> Thu, 18 Jul 2013 20:31:51 GMT attachment set https://svn.boost.org/trac10/ticket/8546 https://svn.boost.org/trac10/ticket/8546 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">algorithm.patch</span> </li> </ul> Ticket Marshall Clow Mon, 22 Jul 2013 15:46:44 GMT <link>https://svn.boost.org/trac10/ticket/8546#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85106" title="Removed unused typedef; Refs #8546">[85106]</a>) Removed unused typedef; Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8546" title="#8546: Bugs: GCC 4.8 warns unused local typedef (closed: fixed)">#8546</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 23 Jul 2013 16:48:28 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8546#comment:5 https://svn.boost.org/trac10/ticket/8546#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85134" title="Merge bug fix to Release; Fixes #8546">[85134]</a>) Merge bug fix to Release; Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8546" title="#8546: Bugs: GCC 4.8 warns unused local typedef (closed: fixed)">#8546</a> </p> Ticket roland@… Mon, 02 Dec 2013 10:22:57 GMT <link>https://svn.boost.org/trac10/ticket/8546#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:6</guid> <description> <p> It appears <a class="changeset" href="https://svn.boost.org/trac10/changeset/84470" title="Added unused attribute for new versions of GCC">[84470]</a> 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: </p> <pre class="wiki">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)); </pre><p> so I think this bug may have been closed slightly prematurely. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 10 Dec 2013 19:09:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8546#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:7</guid> <description> <p> This has just recently been merged to release in Git. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 03 Mar 2014 22:42:56 GMT</pubDate> <title>status, version, component changed; resolution deleted https://svn.boost.org/trac10/ticket/8546#comment:8 https://svn.boost.org/trac10/ticket/8546#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.54.0</span> → <span class="trac-field-new">Boost Development Trunk</span> </li> <li><strong>component</strong> <span class="trac-field-old">algorithm</span> → <span class="trac-field-new">GIL</span> </li> </ul> <p> This applies to the new GIL currently in trunk. </p> Ticket gereon.kremer@… Tue, 01 Sep 2015 12:52:17 GMT <link>https://svn.boost.org/trac10/ticket/8546#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:9</guid> <description> <p> 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? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 01 Sep 2015 13:50:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8546#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:10</guid> <description> <blockquote class="citation"> <p> This behaviour still persists as of now (boost 1.58.0, clang 3.6.2). </p> </blockquote> <p> 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". </p> <p> 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. </p> <p> If you're having other problems, let me know - but please be specific. </p> </description> <category>Ticket</category> </item> <item> <author>gereon.kremer@…</author> <pubDate>Wed, 02 Sep 2015 11:52:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8546#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:11</guid> <description> <p> 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: </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&lt;boost/concept_check.hpp&gt;</span><span class="cp"></span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="k">typename</span> <span class="n">TT</span><span class="o">&gt;</span> <span class="kt">void</span> <span class="n">require_type</span><span class="p">(</span><span class="k">const</span> <span class="n">TT</span><span class="o">&amp;</span> <span class="n">tt</span><span class="p">)</span> <span class="p">{</span> <span class="n">T</span> <span class="n">t</span> <span class="o">=</span> <span class="n">tt</span><span class="p">;</span> <span class="p">(</span><span class="kt">void</span><span class="p">)(</span><span class="n">t</span><span class="p">);</span> <span class="p">}</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T1</span><span class="o">&gt;</span> <span class="k">struct</span> <span class="n">UnaryMinus</span> <span class="p">{</span> <span class="n">T1</span> <span class="n">t</span><span class="p">;</span> <span class="n">BOOST_CONCEPT_USAGE</span><span class="p">(</span><span class="n">UnaryMinus</span><span class="p">)</span> <span class="p">{</span> <span class="n">require_type</span><span class="o">&lt;</span><span class="n">T1</span><span class="o">&gt;</span><span class="p">(</span><span class="o">-</span><span class="n">t</span><span class="p">);</span> <span class="p">}</span> <span class="p">};</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="n">BOOST_CONCEPT_ASSERT</span><span class="p">((</span><span class="n">UnaryMinus</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">));</span> <span class="p">}</span> </pre></div></div> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 02 Sep 2015 15:00:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8546#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8546#comment:12</guid> <description> <blockquote class="citation"> <p> Okay, then I'll wait for 1.59 and see if it vanishes </p> </blockquote> <p> Boost 1.59.0 was released three weeks ago. :-) </p> <p> Using that, I get no warning with your code and clang ToT or GCC 5.1 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Thu, 16 Feb 2017 10:51:51 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/8546#comment:13 https://svn.boost.org/trac10/ticket/8546#comment:13 <ul> <li><strong>cc</strong> <span class="trac-author">mateusz@…</span> added </li> </ul> Ticket Marshall Clow Mon, 08 May 2017 17:12:01 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8546#comment:14 https://svn.boost.org/trac10/ticket/8546#comment:14 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I get no warnings (with Boost 1.64.0), so I'm closing this as fixed. </p> Ticket