From 48b6934f7fba00127617e755e6e5bea86e304c7d Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 17 Jul 2006 10:49:22 +0000 Subject: [PATCH 01/27] Added license info. [SVN r34585] --- Jamfile | 4 ++++ Jamfile.v2 | 4 ++++ index.html | 4 ++++ static_assert.htm | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/Jamfile b/Jamfile index 78e634f..99b5a90 100644 --- a/Jamfile +++ b/Jamfile @@ -1,4 +1,7 @@ # copyright John Maddock 2003 +# Use, modification and distribution are subject to the +# Boost Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) subproject libs/static_assert ; # bring in the rules for testing @@ -27,3 +30,4 @@ test-suite static_assert : + diff --git a/Jamfile.v2 b/Jamfile.v2 index 6b13740..14dfe2f 100644 --- a/Jamfile.v2 +++ b/Jamfile.v2 @@ -1,4 +1,7 @@ # copyright John Maddock 2003 +# Use, modification and distribution are subject to the +# Boost Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # bring in the rules for testing import testing ; @@ -25,3 +28,4 @@ test-suite static_assert : + diff --git a/index.html b/index.html index 2a7339e..f1e6c32 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,10 @@ or view the online version at http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_staticassert.html +

Copyright John Maddock 2006

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt).

+ diff --git a/static_assert.htm b/static_assert.htm index 2a7339e..f1e6c32 100644 --- a/static_assert.htm +++ b/static_assert.htm @@ -9,6 +9,10 @@ or view the online version at http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/boost_staticassert.html +

Copyright John Maddock 2006

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt).

+ From c68b2114de2f83012c743d55aea176fd37ad446b Mon Sep 17 00:00:00 2001 From: John Maddock Date: Fri, 11 Aug 2006 18:14:13 +0000 Subject: [PATCH 02/27] Added trivial docs change, based on user suggestion, and brought example code into synch. [SVN r34874] --- doc/static_assert.qbk | 11 +++++++---- static_assert_example_1.cpp | 4 +++- static_assert_example_3.cpp | 5 +++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index da21287..7ff0b58 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -49,11 +49,12 @@ be an unsigned type. We can verify this at compile time as follows: #include #include + #include #include namespace my_conditions { - BOOST_STATIC_ASSERT(sizeof(int) * CHAR_BIT >= 32); + BOOST_STATIC_ASSERT(std::numeric_limits::digits >= 32); BOOST_STATIC_ASSERT(WCHAR_MIN >= 0); } // namespace my_conditions @@ -61,7 +62,7 @@ be an unsigned type. We can verify this at compile time as follows: The use of the namespace my_conditions here requires some comment. The macro `BOOST_STATIC_ASSERT` works by generating an typedef declaration, and since the typedef must have a name, the macro generates one automatically by -mangling a stub name with the value of __LINE__. When `BOOST_STATIC_ASSERT` is +mangling a stub name with the value of `__LINE__`. When `BOOST_STATIC_ASSERT` is used at either class or function scope then each use of `BOOST_STATIC_ASSERT` is guaranteed to produce a name unique to that scope (provided you only use the macro once on each line). However when used in a header at namespace @@ -128,8 +129,8 @@ using something like this: class myclass { private: - BOOST_STATIC_ASSERT(sizeof(UnsignedInt) * CHAR_BIT >= 16); - BOOST_STATIC_ASSERT(std::numeric_limits::is_specialized + BOOST_STATIC_ASSERT((std::numeric_limits::digits >= 16) + && std::numeric_limits::is_specialized && std::numeric_limits::is_integer && !std::numeric_limits::is_signed); public: @@ -216,3 +217,5 @@ working at namespace, function, and class scope outweighed the ugliness of a mac ] [endsect] + + diff --git a/static_assert_example_1.cpp b/static_assert_example_1.cpp index f5efdf7..14c529c 100644 --- a/static_assert_example_1.cpp +++ b/static_assert_example_1.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #if !defined(WCHAR_MIN) @@ -16,7 +17,7 @@ namespace boost{ namespace my_conditions { -BOOST_STATIC_ASSERT(sizeof(int) * CHAR_BIT >= 32); +BOOST_STATIC_ASSERT(std::numeric_limits::digits >= 32); BOOST_STATIC_ASSERT(WCHAR_MIN >= 0); } // namespace my_conditions @@ -30,3 +31,4 @@ int main() + diff --git a/static_assert_example_3.cpp b/static_assert_example_3.cpp index cf12ce5..e958131 100644 --- a/static_assert_example_3.cpp +++ b/static_assert_example_3.cpp @@ -13,8 +13,8 @@ template class myclass { private: - BOOST_STATIC_ASSERT(sizeof(UnsignedInt) * CHAR_BIT >= 16); - BOOST_STATIC_ASSERT(std::numeric_limits::is_specialized + BOOST_STATIC_ASSERT((std::numeric_limits::digits >= 16) + && std::numeric_limits::is_specialized && std::numeric_limits::is_integer && !std::numeric_limits::is_signed); public: @@ -30,3 +30,4 @@ int main() return 0; } + From a0dac351fb5287b3082b58979b326886d6623937 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 22 Nov 2006 15:58:39 +0000 Subject: [PATCH 03/27] Preliminary C++0x support [SVN r36149] --- include/boost/static_assert.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 9d24c05..6ac3f3d 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -28,6 +28,10 @@ # define BOOST_SA_GCC_WORKAROUND #endif +#ifdef BOOST_CXX0X_STATIC_ASSERT +# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) +#else + namespace boost{ // HP aCC cannot deal with missing names for template value parameters @@ -111,7 +115,7 @@ template struct static_assert_test{}; enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } #endif - +#endif // ndef BOOST_HAS_STATIC_ASSERT #endif // BOOST_STATIC_ASSERT_HPP From b9a3b24aeff62080c7ecfd03fe41c8245715a32d Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 31 Dec 2006 17:27:27 +0000 Subject: [PATCH 04/27] remove dead file. [SVN r36552] --- Jamfile | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 Jamfile diff --git a/Jamfile b/Jamfile deleted file mode 100644 index 99b5a90..0000000 --- a/Jamfile +++ /dev/null @@ -1,33 +0,0 @@ -# copyright John Maddock 2003 -# Use, modification and distribution are subject to the -# Boost Software License, Version 1.0. (See accompanying file -# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -subproject libs/static_assert ; -# bring in the rules for testing -import testing ; - -test-suite static_assert : - [ run static_assert_test.cpp ] -# [ run static_assert_example_1.cpp ] - [ run static_assert_example_2.cpp ] - [ run static_assert_example_3.cpp ] - [ compile-fail static_assert_test_fail_1.cpp ] - [ compile-fail static_assert_test_fail_2.cpp ] - [ compile-fail static_assert_test_fail_3.cpp ] - [ compile-fail static_assert_test_fail_4.cpp ] - [ compile-fail static_assert_test_fail_5.cpp ] - [ compile-fail static_assert_test_fail_6.cpp ] - [ compile-fail static_assert_test_fail_7.cpp ] - [ compile-fail static_assert_test_fail_8.cpp ] - [ compile-fail static_assert_test_fail_9.cpp ] - [ compile-fail static_assert_test_fail_10.cpp ] -; - - - - - - - - From 1663a635aa16446229a8ca8336c78b3a8cb5ffbf Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 14 Mar 2007 09:20:38 +0000 Subject: [PATCH 05/27] Fix C++0x helper macros [SVN r37178] --- include/boost/static_assert.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 6ac3f3d..3ffa952 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -28,7 +28,7 @@ # define BOOST_SA_GCC_WORKAROUND #endif -#ifdef BOOST_CXX0X_STATIC_ASSERT +#ifdef BOOST_HAS_STATIC_ASSERT # define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) #else From bc5065e4958588dd3ad9f1031baf6402f37e41bc Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 21 Feb 2008 16:49:59 +0000 Subject: [PATCH 06/27] Added link to PDF docs. [SVN r43357] --- doc/static_assert.qbk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 7ff0b58..4b62e84 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -15,6 +15,10 @@ [last-revision $Date$] ] +This manual is also available in +[@http:svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf +printer friendly PDF format]. + [section:intro Overview and Tutorial] The header `` supplies a single macro `BOOST_STATIC_ASSERT(x)`, @@ -94,12 +98,17 @@ the user that the template is being misused. #include template - RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to) + RandomAccessIterator foo(RandomAccessIterator from, + RandomAccessIterator to) { // this template can only be used with // random access iterators... - typedef typename std::iterator_traits< RandomAccessIterator >::iterator_category cat; - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + typedef typename std::iterator_traits< + RandomAccessIterator >::iterator_category cat; + BOOST_STATIC_ASSERT( + (boost::is_convertible< + cat, + const std::random_access_iterator_tag&>::value)); // // detail goes here... return from; From 8b819d5c6c61d157affe731f5ed9d5568c576760 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 1 Apr 2008 17:53:56 +0000 Subject: [PATCH 07/27] Changed BOOST_STATIC_ASSERT for GCC to suppress warnings about old C style casts. [SVN r43988] --- include/boost/static_assert.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 3ffa952..5bded5e 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -28,6 +28,16 @@ # define BOOST_SA_GCC_WORKAROUND #endif +// +// If the compiler issues warnings about old C style casts, +// then enable this: +// +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))) +# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true) +#else +# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) +#endif + #ifdef BOOST_HAS_STATIC_ASSERT # define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) #else @@ -78,14 +88,14 @@ template struct static_assert_test{}; #elif defined(BOOST_MSVC) #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST ( B ) >)>\ BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__) #elif defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND) // agurt 15/sep/02: a special care is needed to force Intel C++ issue an error // instead of warning in case of failure # define BOOST_STATIC_ASSERT( B ) \ typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \ - [ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ] + [ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >::value ] #elif defined(__sgi) // special version for SGI MIPSpro compiler #define BOOST_STATIC_ASSERT( B ) \ @@ -100,12 +110,12 @@ template struct static_assert_test{}; #define BOOST_STATIC_ASSERT( B ) \ BOOST_STATIC_CONSTANT(int, \ BOOST_JOIN(boost_static_assert_test_, __LINE__) = \ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) ) + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >) ) #else // generic version #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\ BOOST_JOIN(boost_static_assert_typedef_, __LINE__) #endif From 8cfe5d77c00285a4613858797605cdd6f1f332d4 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 12 Jul 2008 19:32:15 +0000 Subject: [PATCH 08/27] Fix a PDF link that I missed before. [SVN r47364] --- doc/static_assert.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 4b62e84..6063a12 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -16,7 +16,7 @@ ] This manual is also available in -[@http:svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf +[@http://svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf printer friendly PDF format]. [section:intro Overview and Tutorial] From effe841116099465b73d1ec26513a57365870c17 Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Sat, 1 Nov 2008 13:15:41 +0000 Subject: [PATCH 09/27] Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor [SVN r49510] --- CMakeLists.txt | 22 ++++++++++++++++++++++ test/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..392b493 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +#---------------------------------------------------------------------------- +# This file was automatically generated from the original CMakeLists.txt file +# Add a variable to hold the headers for the library +set (lib_headers + static_assert.hpp + +) + +# Add a library target to the build system +boost_library_project( + static_assert + # SRCDIRS + TESTDIRS test + HEADERS ${lib_headers} + # DOCDIRS + # DESCRIPTION + MODULARIZED + # AUTHORS + # MAINTAINERS +) + + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..4cea129 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,13 @@ +boost_test_run(static_assert_test ../static_assert_test.cpp) +boost_test_run(static_assert_example_2 ../static_assert_example_2.cpp) +boost_test_run(static_assert_example_3 ../static_assert_example_3.cpp) +boost_test_compile_fail(static_assert_test_fail_1 ../static_assert_test_fail_1.cpp) +boost_test_compile_fail(static_assert_test_fail_2 ../static_assert_test_fail_2.cpp) +boost_test_compile_fail(static_assert_test_fail_3 ../static_assert_test_fail_3.cpp) +boost_test_compile_fail(static_assert_test_fail_4 ../static_assert_test_fail_4.cpp) +boost_test_compile_fail(static_assert_test_fail_5 ../static_assert_test_fail_5.cpp) +boost_test_compile_fail(static_assert_test_fail_6 ../static_assert_test_fail_6.cpp) +boost_test_compile_fail(static_assert_test_fail_7 ../static_assert_test_fail_7.cpp) +boost_test_compile_fail(static_assert_test_fail_8 ../static_assert_test_fail_8.cpp) +boost_test_compile_fail(static_assert_test_fail_9 ../static_assert_test_fail_9.cpp) +boost_test_compile_fail(static_assert_test_fail_10 ../static_assert_test_fail_10.cpp) From a9a9f0591beed9e6bdbe44cbd54273fe2aa95a1c Mon Sep 17 00:00:00 2001 From: "Michael A. Jackson" Date: Fri, 7 Nov 2008 17:05:27 +0000 Subject: [PATCH 10/27] Updating dependency information for modularized libraries. [SVN r49628] --- module.cmake | 1 + 1 file changed, 1 insertion(+) create mode 100644 module.cmake diff --git a/module.cmake b/module.cmake new file mode 100644 index 0000000..e68fe53 --- /dev/null +++ b/module.cmake @@ -0,0 +1 @@ +boost_module(static_assert DEPENDS config detail) \ No newline at end of file From 413e7eda07a4151057eff02b8b1ea3bbdbd368f0 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 23 Dec 2008 12:03:43 +0000 Subject: [PATCH 11/27] Fix inclusion of incorrect header. Fixes #2537. [SVN r50371] --- doc/static_assert.qbk | 2 +- static_assert_example_3.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 6063a12..142cdbf 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -131,7 +131,7 @@ Suppose we have a template-class that requires an unsigned integral type with at least 16-bits of precision as a template argument, we can achieve this using something like this: - #include + #include #include template diff --git a/static_assert_example_3.cpp b/static_assert_example_3.cpp index e958131..1cc1545 100644 --- a/static_assert_example_3.cpp +++ b/static_assert_example_3.cpp @@ -5,7 +5,7 @@ // See http://www.boost.org for most recent version including documentation. -#include +#include #include #include From a7e33291ebd865f6fe5824c6cb74976ff772ee94 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Fri, 30 Jan 2009 18:20:49 +0000 Subject: [PATCH 12/27] Fix up PDF generation options. [SVN r50910] --- doc/Jamfile.v2 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 261c316..7e4ac9d 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -5,6 +5,8 @@ using quickbook ; +path-constant boost-images : ../../../doc/src/images ; + xml static_assert : static_assert.qbk ; boostbook standalone : @@ -12,9 +14,30 @@ boostbook standalone : nav.layout=none navig.graphics=0 + # PDF Options: + # TOC Generation: this is needed for FOP-0.9 and later: + fop1.extensions=0 + # Or enable this if you're using XEP: + xep.extensions=1 + # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9! + fop.extensions=0 + # No indent on body text: + body.start.indent=0pt + # Margin size: + page.margin.inner=0.5in + # Margin size: + page.margin.outer=0.5in + # Yes, we want graphics for admonishments: + admon.graphics=1 + # Set this one for PDF generation *only*: + # default pnd graphics are awful in PDF form, + # better use SVG's instead: + pdf:admon.graphics.extension=".svg" + pdf:admon.graphics.path=$(boost-images)/ ; install html : ../../../doc/html/boostbook.css ; install ../ : ../../../boost.png ; + From 62461d88489a79186ad64d4b644e6327f991be54 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 17 Feb 2009 10:05:58 +0000 Subject: [PATCH 13/27] Add PDF generation options to fix external links to point to the web site. Added a few more Boostbook based libs that were missed first time around. Fixed PDF naming issues. [SVN r51284] --- doc/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 7e4ac9d..a8dac07 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -34,6 +34,7 @@ boostbook standalone # better use SVG's instead: pdf:admon.graphics.extension=".svg" pdf:admon.graphics.path=$(boost-images)/ + pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html ; install html : ../../../doc/html/boostbook.css ; From 87ecd7d39f9ca10003acc872821e6c0c8990ecf0 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sun, 26 Jul 2009 00:49:56 +0000 Subject: [PATCH 14/27] Copyrights on CMakeLists.txt to keep them from clogging up the inspect reports. This is essentially the same commit as r55095 on the release branch. [SVN r55159] --- CMakeLists.txt | 6 ++++++ test/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 392b493..dbc799c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# #---------------------------------------------------------------------------- # This file was automatically generated from the original CMakeLists.txt file # Add a variable to hold the headers for the library diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4cea129..a9afaf2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,3 +1,9 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# boost_test_run(static_assert_test ../static_assert_test.cpp) boost_test_run(static_assert_example_2 ../static_assert_example_2.cpp) boost_test_run(static_assert_example_3 ../static_assert_example_3.cpp) From 5d9274a6836ed1ed12bb4801b41711ccbebe5d32 Mon Sep 17 00:00:00 2001 From: "Troy D. Straszheim" Date: Sat, 17 Oct 2009 02:07:38 +0000 Subject: [PATCH 15/27] rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back [SVN r56942] --- CMakeLists.txt | 28 ---------------------------- module.cmake | 1 - test/CMakeLists.txt | 19 ------------------- 3 files changed, 48 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 module.cmake delete mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index dbc799c..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -#---------------------------------------------------------------------------- -# This file was automatically generated from the original CMakeLists.txt file -# Add a variable to hold the headers for the library -set (lib_headers - static_assert.hpp - -) - -# Add a library target to the build system -boost_library_project( - static_assert - # SRCDIRS - TESTDIRS test - HEADERS ${lib_headers} - # DOCDIRS - # DESCRIPTION - MODULARIZED - # AUTHORS - # MAINTAINERS -) - - diff --git a/module.cmake b/module.cmake deleted file mode 100644 index e68fe53..0000000 --- a/module.cmake +++ /dev/null @@ -1 +0,0 @@ -boost_module(static_assert DEPENDS config detail) \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index a9afaf2..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright Troy D. Straszheim -# -# Distributed under the Boost Software License, Version 1.0. -# See http://www.boost.org/LICENSE_1_0.txt -# -boost_test_run(static_assert_test ../static_assert_test.cpp) -boost_test_run(static_assert_example_2 ../static_assert_example_2.cpp) -boost_test_run(static_assert_example_3 ../static_assert_example_3.cpp) -boost_test_compile_fail(static_assert_test_fail_1 ../static_assert_test_fail_1.cpp) -boost_test_compile_fail(static_assert_test_fail_2 ../static_assert_test_fail_2.cpp) -boost_test_compile_fail(static_assert_test_fail_3 ../static_assert_test_fail_3.cpp) -boost_test_compile_fail(static_assert_test_fail_4 ../static_assert_test_fail_4.cpp) -boost_test_compile_fail(static_assert_test_fail_5 ../static_assert_test_fail_5.cpp) -boost_test_compile_fail(static_assert_test_fail_6 ../static_assert_test_fail_6.cpp) -boost_test_compile_fail(static_assert_test_fail_7 ../static_assert_test_fail_7.cpp) -boost_test_compile_fail(static_assert_test_fail_8 ../static_assert_test_fail_8.cpp) -boost_test_compile_fail(static_assert_test_fail_9 ../static_assert_test_fail_9.cpp) -boost_test_compile_fail(static_assert_test_fail_10 ../static_assert_test_fail_10.cpp) From 138c5bde910ddff6cec5550d042a3b3647c23a33 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 8 Nov 2009 18:59:24 +0000 Subject: [PATCH 16/27] Fix gcc warning. [SVN r57495] --- static_assert_example_2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static_assert_example_2.cpp b/static_assert_example_2.cpp index 039c602..a32b79d 100644 --- a/static_assert_example_2.cpp +++ b/static_assert_example_2.cpp @@ -12,7 +12,7 @@ #include template -RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to) +RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator /*to*/) { // this template can only be used with // random access iterators... From 80c63408334c81a13ad61d0ccd832cba3e63f0d2 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 16 Feb 2010 12:45:53 +0000 Subject: [PATCH 17/27] Use BOOST_NO_STATIC_ASSERT [SVN r59698] --- include/boost/static_assert.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 5bded5e..e8b3d10 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -38,7 +38,7 @@ # define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) #endif -#ifdef BOOST_HAS_STATIC_ASSERT +#ifndef BOOST_NO_STATIC_ASSERT # define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) #else @@ -125,7 +125,7 @@ template struct static_assert_test{}; enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } #endif -#endif // ndef BOOST_HAS_STATIC_ASSERT +#endif // defined(BOOST_NO_STATIC_ASSERT) #endif // BOOST_STATIC_ASSERT_HPP From a0a2bd5703335e359501ee757a8b288834b54678 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 20 Jun 2010 18:00:48 +0000 Subject: [PATCH 18/27] Update various libraries' documentation build. Mostly to use the images and css files under doc/src instead of doc/html, usually be deleting the settings in order to use the defaults. Also add 'boost.root' to some builds in order to fix links which rely on it. [SVN r63146] --- doc/Jamfile.v2 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index a8dac07..1f8565d 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -12,6 +12,7 @@ boostbook standalone : static_assert : + boost.root=../../../.. nav.layout=none navig.graphics=0 # PDF Options: @@ -36,9 +37,3 @@ boostbook standalone pdf:admon.graphics.path=$(boost-images)/ pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html ; - -install html : ../../../doc/html/boostbook.css ; -install ../ : ../../../boost.png ; - - - From f57e592d1ef8a0ccd308f37d2b9df6e85e162369 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 1 Jan 2011 12:28:35 +0000 Subject: [PATCH 19/27] Change PDF URL to SF download page. [SVN r67529] --- doc/static_assert.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 142cdbf..1b5b7be 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -16,7 +16,7 @@ ] This manual is also available in -[@http://svn.boost.org/svn/boost/sandbox/pdf/static_assert/release/static_assert.pdf +[@http://sourceforge.net/projects/boost/files/boost-docs/ printer friendly PDF format]. [section:intro Overview and Tutorial] From e910489e163dfcd8ffb68949511cf329e54879e5 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Mon, 31 Jan 2011 15:03:41 +0000 Subject: [PATCH 20/27] Add BOOST_STATIC_ASSERT_MSG [SVN r68584] --- doc/static_assert.qbk | 23 ++++++++++++++++++----- include/boost/static_assert.hpp | 6 ++++++ static_assert_test.cpp | 15 +++++++++++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 1b5b7be..97a7418 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -21,15 +21,28 @@ printer friendly PDF format]. [section:intro Overview and Tutorial] -The header `` supplies a single macro `BOOST_STATIC_ASSERT(x)`, -which generates a compile time error message if the integral-constant-expression `x` -is not true. In other words it is the compile time equivalent of the assert macro; +The header `` supplies two macros: + + BOOST_STATIC_ASSERT(x) + BOOST_STATIC_ASSERT_MSG(x, msg) + +Both generate a compile time error message if the integral-constant-expression `x` +is not true. In other words, they are the compile time equivalent of the assert macro; this is sometimes known as a "compile-time-assertion", but will be called a "static assertion" throughout these docs. Note that if the condition is `true`, -then the macro will generate neither code nor data - and the macro can also +then the macros will generate neither code nor data - and the macros can also be used at either namespace, class or function scope. When used in a template, the static assertion will be evaluated at the time the template is instantiated; -this is particularly useful for validating template parameters. +this is particularly useful for validating template parameters. + +If the C++0x `static_assert` feature is available, both macros will use it. +For `BOOST_STATIC_ASSERT(x)`, the error message with be a stringized version of `x`. +For `BOOST_STATIC_ASSERT_MSG(x, msg)`, the error message will be the `msg` string. + +If the C++0x `static_assert` feature is not available, `BOOST_STATIC_ASSERT_MSG(x, msg)` +will be treated as `BOOST_STATIC_ASSERT(x)`. + +The material that follows assumes the C++0x `static_assert` feature is not available. One of the aims of `BOOST_STATIC_ASSERT` is to generate readable error messages. These immediately tell the user that a library is being used in a manner that diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index e8b3d10..9fe9bc0 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -17,6 +17,12 @@ #include #include +#ifndef BOOST_NO_STATIC_ASSERT +# define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) +#else +# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) +#endif + #ifdef __BORLANDC__ // // workaround for buggy integral-constant expression support: diff --git a/static_assert_test.cpp b/static_assert_test.cpp index 85457e8..3147e5c 100644 --- a/static_assert_test.cpp +++ b/static_assert_test.cpp @@ -16,12 +16,16 @@ // Namespace scope BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short)); BOOST_STATIC_ASSERT(sizeof(char) == 1); +BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg1"); +BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg2"); // Function (block) scope void f() { BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short)); BOOST_STATIC_ASSERT(sizeof(char) == 1); + BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg3"); + BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg4"); } struct Bob @@ -29,6 +33,8 @@ struct Bob private: // can be in private, to avoid namespace pollution BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short)); BOOST_STATIC_ASSERT(sizeof(char) == 1); + BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg5"); + BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg6"); public: // Member function scope: provides access to member variables @@ -36,9 +42,11 @@ struct Bob char c; int f() { -#ifndef _MSC_VER // broken sizeof in VC6 +#if defined(_MSC_VER) && _MSC_VER < 1300 // broken sizeof in VC6 BOOST_STATIC_ASSERT(sizeof(x) >= sizeof(short)); BOOST_STATIC_ASSERT(sizeof(c) == 1); + BOOST_STATIC_ASSERT_MSG(sizeof(x) >= sizeof(short), "msg7"); + BOOST_STATIC_ASSERT_MSG(sizeof(c) == 1, "msg8"); #endif return x; } @@ -52,6 +60,7 @@ struct Bill { private: // can be in private, to avoid namespace pollution BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(char)); + BOOST_STATIC_ASSERT_MSG(sizeof(Int) > sizeof(char), "msg9"); public: // Template member function scope: provides access to member variables @@ -62,10 +71,12 @@ struct Bill { BOOST_STATIC_ASSERT(sizeof(Int) == sizeof(Int2)); BOOST_STATIC_ASSERT(sizeof(Char) == sizeof(Char2)); + BOOST_STATIC_ASSERT_MSG(sizeof(Int) == sizeof(Int2), "msg10"); + BOOST_STATIC_ASSERT_MSG(sizeof(Char) == sizeof(Char2), "msg11"); } }; -void test_Bill() // BOOST_CT_ASSERTs are not triggerred until instantiated +void test_Bill() // BOOST_STATIC_ASSERTs are not triggerred until instantiated { Bill z; //Bill bad; // will not compile From 5e7b62a1f4ad41d961f5c0089b0fda92879d4fab Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 16 Aug 2012 08:14:53 +0000 Subject: [PATCH 21/27] Fix doc typo. Fixes #6355. [SVN r80059] --- doc/static_assert.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 97a7418..0cc8cfc 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -36,7 +36,7 @@ the static assertion will be evaluated at the time the template is instantiated; this is particularly useful for validating template parameters. If the C++0x `static_assert` feature is available, both macros will use it. -For `BOOST_STATIC_ASSERT(x)`, the error message with be a stringized version of `x`. +For `BOOST_STATIC_ASSERT(x)`, the error message will be a stringized version of `x`. For `BOOST_STATIC_ASSERT_MSG(x, msg)`, the error message will be the `msg` string. If the C++0x `static_assert` feature is not available, `BOOST_STATIC_ASSERT_MSG(x, msg)` From ce9e800db83fc039b76cbcafaafa8da5024a011d Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 27 Nov 2012 14:30:10 +0000 Subject: [PATCH 22/27] Removed missed usage of deprecated macros in Boost.StaticAssert [SVN r81588] --- include/boost/static_assert.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 9fe9bc0..0bc3ef6 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -17,7 +17,7 @@ #include #include -#ifndef BOOST_NO_STATIC_ASSERT +#ifndef BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) #else # define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) @@ -44,7 +44,7 @@ # define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) #endif -#ifndef BOOST_NO_STATIC_ASSERT +#ifndef BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) #else @@ -131,7 +131,7 @@ template struct static_assert_test{}; enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } #endif -#endif // defined(BOOST_NO_STATIC_ASSERT) +#endif // defined(BOOST_NO_CXX11_STATIC_ASSERT) #endif // BOOST_STATIC_ASSERT_HPP From 2993231dad5247e6850c0ce28c66ccb7bda4d996 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 14 Feb 2013 18:31:33 +0000 Subject: [PATCH 23/27] Use variadic macros in static assert to make use easier. Add warning suppression for GCC. Minor doc fix. Fixes #5810. Fixes #7242. Fixes #7966. [SVN r82886] --- doc/static_assert.qbk | 8 ++--- include/boost/static_assert.hpp | 60 ++++++++++++++++++++++++++------- static_assert_test.cpp | 10 ++++++ 3 files changed, 62 insertions(+), 16 deletions(-) diff --git a/doc/static_assert.qbk b/doc/static_assert.qbk index 0cc8cfc..2fab4d9 100644 --- a/doc/static_assert.qbk +++ b/doc/static_assert.qbk @@ -151,10 +151,10 @@ using something like this: class myclass { private: - BOOST_STATIC_ASSERT((std::numeric_limits::digits >= 16) - && std::numeric_limits::is_specialized - && std::numeric_limits::is_integer - && !std::numeric_limits::is_signed); + BOOST_STATIC_ASSERT_MSG(std::numeric_limits::is_specialized, "myclass can only be specialized for types with numeric_limits support."); + BOOST_STATIC_ASSERT_MSG(std::numeric_limits::digits >= 16, "Template argument UnsignedInt must have at least 16 bits precision.") + BOOST_STATIC_ASSERT_MSG(std::numeric_limits::is_integer, "Template argument UnsignedInt must be an integer."); + BOOST_STATIC_ASSERT_MSG(!std::numeric_limits::is_signed, "Template argument UnsignedInt must not be signed."); public: /* details here */ }; diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 0bc3ef6..d11411a 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -18,9 +18,13 @@ #include #ifndef BOOST_NO_CXX11_STATIC_ASSERT -# define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) +# else +# define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) +# endif #else -# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) +# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) #endif #ifdef __BORLANDC__ @@ -39,13 +43,33 @@ // then enable this: // #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))) -# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true) +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT_BOOL_CAST( ... ) ((__VA_ARGS__) == 0 ? false : true) +# else +# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true) +# endif #else -# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT_BOOL_CAST( ... ) (bool)(__VA_ARGS__) +# else +# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) +# endif +#endif +// +// 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 #ifndef BOOST_NO_CXX11_STATIC_ASSERT -# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__) +# else +# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) +# endif #else namespace boost{ @@ -119,17 +143,29 @@ template struct static_assert_test{}; sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >) ) #else // generic version -#define BOOST_STATIC_ASSERT( B ) \ - typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\ - BOOST_JOIN(boost_static_assert_typedef_, __LINE__) +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT( ... ) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( __VA_ARGS__ ) >)>\ + BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE +# else +# define BOOST_STATIC_ASSERT( B ) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\ + BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE +# endif #endif #else // alternative enum based implementation: -#define BOOST_STATIC_ASSERT( B ) \ - enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ - = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } +# ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_STATIC_ASSERT( ... ) \ + enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ + = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( __VA_ARGS__ ) >) } +# else + enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ + = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } +# endif #endif #endif // defined(BOOST_NO_CXX11_STATIC_ASSERT) diff --git a/static_assert_test.cpp b/static_assert_test.cpp index 3147e5c..bddebcb 100644 --- a/static_assert_test.cpp +++ b/static_assert_test.cpp @@ -58,6 +58,7 @@ struct Bob template struct Bill { + BOOST_STATIC_CONSTANT(int, value = 1); private: // can be in private, to avoid namespace pollution BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(char)); BOOST_STATIC_ASSERT_MSG(sizeof(Int) > sizeof(char), "msg9"); @@ -89,6 +90,15 @@ void test_Bill() // BOOST_STATIC_ASSERTs are not triggerred until instantiated int main() { test_Bill(); + // + // Test variadic macro support: + // +#ifndef BOOST_NO_CXX11_VARIADIC_MACROS + BOOST_STATIC_ASSERT(Bill::value); +#ifndef BOOST_NO_CXX11_STATIC_ASSERT + BOOST_STATIC_ASSERT_MSG(Bill::value, "This is a message"); +#endif +#endif return 0; } From c40a626f1c0c85af4e147247ed223241b3d7b1dd Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 23 Feb 2013 18:26:39 +0000 Subject: [PATCH 24/27] Suppress GCC warnings. [SVN r83104] --- include/boost/static_assert.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index d11411a..c1343c0 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -17,6 +17,15 @@ #include #include +#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) +// +// This is horrible, but it seems to be the only we can shut up the +// "anonymous variadic macros were introduced in C99 [-Wvariadic-macros]" +// warning that get spewed out otherwise in non-C++11 mode. +// +#pragma GCC system_header +#endif + #ifndef BOOST_NO_CXX11_STATIC_ASSERT # ifndef BOOST_NO_CXX11_VARIADIC_MACROS # define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) From bf3ee216308142ee36b7bf43c3f3f57e994d0ada Mon Sep 17 00:00:00 2001 From: John Maddock Date: Fri, 15 Mar 2013 18:21:03 +0000 Subject: [PATCH 25/27] More variadic macro support for msvc and Intel. [SVN r83444] --- include/boost/static_assert.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index c1343c0..256ca09 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -124,17 +124,28 @@ template struct static_assert_test{}; typedef ::boost::static_assert_test<\ sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\ > boost_static_assert_typedef_ -#elif defined(BOOST_MSVC) +#elif defined(BOOST_MSVC) && defined(BOOST_NO_CXX11_VARIADIC_MACROS) #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST ( B ) >)>\ BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__) -#elif defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND) +#elif defined(BOOST_MSVC) +#define BOOST_STATIC_ASSERT(...) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST (__VA_ARGS__) >)>\ + BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__) +#elif (defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND)) && defined(BOOST_NO_CXX11_VARIADIC_MACROS) // agurt 15/sep/02: a special care is needed to force Intel C++ issue an error // instead of warning in case of failure # define BOOST_STATIC_ASSERT( B ) \ typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \ [ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >::value ] +#elif (defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND)) && !defined(BOOST_NO_CXX11_VARIADIC_MACROS) +// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error +// instead of warning in case of failure +# define BOOST_STATIC_ASSERT(...) \ + typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \ + [ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( __VA_ARGS__ ) >::value ] #elif defined(__sgi) // special version for SGI MIPSpro compiler #define BOOST_STATIC_ASSERT( B ) \ From 8912d413ba261ed4670490f130ceedac44ad9acc Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 8 Apr 2013 08:45:06 +0000 Subject: [PATCH 26/27] Fix for compilers that have no variadic macros but do have static_assert (are there any??) Fixes #8346. [SVN r83806] --- include/boost/static_assert.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 256ca09..19366d9 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -30,7 +30,7 @@ # ifndef BOOST_NO_CXX11_VARIADIC_MACROS # define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) # else -# define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) +# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) # endif #else # define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) From c951c0db9a868298fdea8f685f7f7022219acedc Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 8 Jun 2013 10:58:41 +0000 Subject: [PATCH 27/27] Apply patch from #8644. Refs #8644. [SVN r84686] --- include/boost/static_assert.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/static_assert.hpp b/include/boost/static_assert.hpp index 19366d9..d083a9c 100644 --- a/include/boost/static_assert.hpp +++ b/include/boost/static_assert.hpp @@ -183,6 +183,7 @@ template struct static_assert_test{}; enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( __VA_ARGS__ ) >) } # else +# define BOOST_STATIC_ASSERT(B) \ enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } # endif