Opened 7 years ago
Closed 7 years ago
#11664 closed Bugs (fixed)
BOOST_STATIC_ASSERT raises unused typedef error with new Apple Xcode 7
| Reported by: | Owned by: | John Maddock | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | static_assert |
| Version: | Boost 1.58.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
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.
Attachments (1)
Change History (3)
by , 7 years ago
| Attachment: | static_assert.hpp-diff added |
|---|
comment:1 by , 7 years ago
| Component: | None → static_assert |
|---|---|
| Owner: | set to |
| Severity: | Showstopper → Problem |
comment:2 by , 7 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
This is already fixed in 'develop' branch: https://github.com/boostorg/static_assert/tree/develop
Note:
See TracTickets
for help on using tickets.

static_assert.hpp diff