[Boost-bugs] [Boost C++ Libraries] #11664: BOOST_STATIC_ASSERT raises unused typedef error with new Apple Xcode 7

Subject: [Boost-bugs] [Boost C++ Libraries] #11664: BOOST_STATIC_ASSERT raises unused typedef error with new Apple Xcode 7
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-17 10:41:22


#11664: BOOST_STATIC_ASSERT raises unused typedef error with new Apple Xcode 7
----------------------------------------+------------------------------
 Reporter: Francis Dupont <fdupont@…> | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.58.0
 Severity: Showstopper | Keywords:
----------------------------------------+------------------------------
 I've just updated by Apple Xcode (OS X compiler suite) to version 7.
 g++ version returns:
 {{{
 Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
 --with-gxx-include-dir=/usr/include/c++/4.2.1
 Apple LLVM version 7.0.0 (clang-700.0.72)
 Target: x86_64-apple-darwin14.5.0
 Thread model: posix
 }}}
 Boost version is 1.58.0 and is installed by brew. The last stable version
 1.59.0 has exactly the same code so should share the issue.

 Code using BOOST_STATIC_ASSERT raises this kind of errors:
 {{{
 In file included from encode/base_n.cc:16:
 ../../../src/lib/util/encode/binary_from_base32hex.h:46:9: error: unused
 typedef 'boost_static_assert_typedef_46' [-Werror,-Wunused-local-typedef]
         BOOST_STATIC_ASSERT(0x80 == sizeof(lookup_table));
         ^
 /usr/local/include/boost/static_assert.hpp:170:16: note: expanded from
 macro 'BOOST_STATIC_ASSERT'
                BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
 BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
                ^
 /usr/local/include/boost/config/suffix.hpp:544:28: note: expanded from
 macro 'BOOST_JOIN'
 #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
                            ^
 /usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from
 macro 'BOOST_DO_JOIN'
 #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
                               ^
 /usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from
 macro 'BOOST_DO_JOIN2'
 #define BOOST_DO_JOIN2( X, Y ) X##Y
                                ^
 <scratch space>:77:1: note: expanded from here
 boost_static_assert_typedef_46
 ^
 }}}

 Note it is not a new issue, cf #7242. But the fix in static_assert.hpp:
 {{{
 //
 // If the compiler warns about unused typedefs then enable this:
 //
 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) &&
 (__GNUC_MINOR__
>= 7)))
 # define BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
 #else
 # define BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE
 #endif
 }}}
 requires to handle the new Apple Clang. I tried with success:
 {{{
 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) &&
 (__GNUC_MINOR__ >= 7))) || (defined(__apple_build_version__) &&
 (__apple_build_version__ >= 7000000))
 }}}

 I am attaching the diff.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11664>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC