Beman Dawes provided the original config.hpp and
part of this document.
- Vesa Karvonen provided a description of the principles (see rationale)
+ Vesa Karvonen provided a description of the principles (see rationale)
and put together an early version of the current configuration setup.
The approach taken by boost's configuration headers is to separate configuration
diff --git a/doc/html/index.html b/doc/html/index.html
index 75b113f5..f11a3c2e 100644
--- a/doc/html/index.html
+++ b/doc/html/index.html
@@ -3,7 +3,7 @@
@@ -152,10 +152,10 @@
them usable by both Boost library and user code.
- Boost informational or helper
+ Boost informational or helper
macros are designed for use by Boost users as well as for our own internal
- use. Note however, that the feature test
- and defect test macros were designed
+ use. Note however, that the feature test
+ and defect test macros were designed
for internal use by Boost libraries, not user code, so they can change at
any time (though no gratuitous changes are made to them). Boost library problems
resulting from changes to the configuration macros are caught by the Boost
@@ -170,7 +170,7 @@
Next the compiler, standard library, and platform configuration files are
included. These are included via macros (BOOST_COMPILER_CONFIG
- etc, see user settable macros),
+ etc, see user settable macros),
and if the corresponding macro is undefined then a separate header that detects
which compiler/standard library/platform is in use is included in order to
set these. The config can be told to ignore these headers altogether if the
corresponding BOOST_NO_XXX
macro is set (for example BOOST_NO_COMPILER_CONFIG
- to disable including any compiler configuration file - see
+ to disable including any compiler configuration file - see
user settable macros).
diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk
index 70e35d51..977eb681 100644
--- a/doc/macro_reference.qbk
+++ b/doc/macro_reference.qbk
@@ -192,6 +192,10 @@ Pointers to members don't work when used as template parameters.
The compiler misreads 8.5.1, treating classes as non-aggregate if they
contain private or protected member functions.
]]
+[[`BOOST_NO_RTTI`][Compiler][
+The compiler may (or may not) have the typeid operator, but RTTI on the dynamic type
+of an object is not supported.
+]]
[[`BOOST_NO_SFINAE`][Compiler][
The compiler does not support the "Substitution Failure Is Not An Error"
meta-programming idiom.
diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp
index 79173580..187591be 100644
--- a/include/boost/config/compiler/visualc.hpp
+++ b/include/boost/config/compiler/visualc.hpp
@@ -123,6 +123,9 @@
#ifndef _MSC_EXTENSIONS
# define BOOST_DISABLE_WIN32
#endif
+#ifndef _CPPRTTI
+# define BOOST_NO_RTTI
+#endif
//
// all versions support __declspec:
diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2
index 2aea1e01..d04849d0 100644
--- a/test/all/Jamfile.v2
+++ b/test/all/Jamfile.v2
@@ -1,7 +1,7 @@
#
# Regression test Jamfile for boost configuration setup.
# *** DO NOT EDIT THIS FILE BY HAND ***
-# This file was automatically generated on Sat Jul 12 12:39:35 2008
+# This file was automatically generated on Mon Aug 25 10:51:52 2008
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
@@ -292,6 +292,9 @@ test-suite "BOOST_NO_POINTER_TO_MEMBER_CONST" :
test-suite "BOOST_NO_UNREACHABLE_RETURN_DETECTION" :
[ run ../no_ret_det_pass.cpp ]
[ compile-fail ../no_ret_det_fail.cpp ] ;
+test-suite "BOOST_NO_RTTI" :
+[ run ../no_rtti_pass.cpp ]
+[ compile-fail ../no_rtti_fail.cpp ] ;
test-suite "BOOST_NO_SFINAE" :
[ run ../no_sfinae_pass.cpp ]
[ compile-fail ../no_sfinae_fail.cpp ] ;
diff --git a/test/boost_no_rtti.ipp b/test/boost_no_rtti.ipp
new file mode 100644
index 00000000..69594722
--- /dev/null
+++ b/test/boost_no_rtti.ipp
@@ -0,0 +1,57 @@
+// (C) Copyright John Maddock 2008.
+// 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)
+
+// See http://www.boost.org/libs/config for most recent version.
+
+// MACRO: BOOST_NO_RTTI
+// TITLE: RTTI unavailable
+// DESCRIPTION: The compiler does not support RTTI in this mode
+
+#include
+
+class A
+{
+public:
+ A(){}
+ virtual void t();
+};
+
+void A::t()
+{
+}
+
+class B : public A
+{
+public:
+ B(){}
+ virtual void t();
+};
+
+void B::t()
+{
+}
+
+namespace boost_no_rtti
+{
+
+int check(const A& a)
+{
+ return typeid(a) == typeid(B) ? 0 : 1;
+}
+
+int test()
+{
+ try{
+ B b;
+ return check(b);
+ }
+ catch(...)
+ {
+ return 1;
+ }
+}
+
+}
+
diff --git a/test/config_info.cpp b/test/config_info.cpp
index e16642f9..91e5fdcf 100644
--- a/test/config_info.cpp
+++ b/test/config_info.cpp
@@ -987,6 +987,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_POINTER_TO_MEMBER_CONST);
PRINT_MACRO(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS);
PRINT_MACRO(BOOST_NO_PRIVATE_IN_AGGREGATE);
+ PRINT_MACRO(BOOST_NO_RTTI);
PRINT_MACRO(BOOST_NO_SFINAE);
PRINT_MACRO(BOOST_NO_STDC_NAMESPACE);
PRINT_MACRO(BOOST_NO_STD_ALLOCATOR);
@@ -1033,6 +1034,7 @@ void print_boost_macros()
+
// END GENERATED BLOCK
diff --git a/test/config_test.cpp b/test/config_test.cpp
index 606a1a64..ef6faef0 100644
--- a/test/config_test.cpp
+++ b/test/config_test.cpp
@@ -1,4 +1,4 @@
-// This file was automatically generated on Sat Jul 12 12:39:34 2008
+// This file was automatically generated on Mon Aug 25 10:51:52 2008
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
@@ -217,6 +217,11 @@ namespace boost_no_pointer_to_member_const = empty_boost;
#else
namespace boost_no_unreachable_return_detection = empty_boost;
#endif
+#ifndef BOOST_NO_RTTI
+#include "boost_no_rtti.ipp"
+#else
+namespace boost_no_rtti = empty_boost;
+#endif
#ifndef BOOST_NO_SFINAE
#include "boost_no_sfinae.ipp"
#else
@@ -1051,6 +1056,11 @@ int main( int, char *[] )
std::cerr << "Failed test for BOOST_NO_UNREACHABLE_RETURN_DETECTION at: " << __FILE__ << ":" << __LINE__ << std::endl;
++error_count;
}
+ if(0 != boost_no_rtti::test())
+ {
+ std::cerr << "Failed test for BOOST_NO_RTTI at: " << __FILE__ << ":" << __LINE__ << std::endl;
+ ++error_count;
+ }
if(0 != boost_no_sfinae::test())
{
std::cerr << "Failed test for BOOST_NO_SFINAE at: " << __FILE__ << ":" << __LINE__ << std::endl;
diff --git a/test/no_rtti_fail.cpp b/test/no_rtti_fail.cpp
new file mode 100644
index 00000000..f24f15d6
--- /dev/null
+++ b/test/no_rtti_fail.cpp
@@ -0,0 +1,37 @@
+// This file was automatically generated on Mon Aug 25 10:51:51 2008
+// by libs/config/tools/generate.cpp
+// Copyright John Maddock 2002-4.
+// 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)
+
+// See http://www.boost.org/libs/config for the most recent version.//
+// Revision $Id: generate.cpp 47351 2008-07-12 12:41:52Z johnmaddock $
+//
+
+
+// Test file for macro BOOST_NO_RTTI
+// This file should not compile, if it does then
+// BOOST_NO_RTTI should not be defined.
+// See file boost_no_rtti.ipp for details
+
+// Must not have BOOST_ASSERT_CONFIG set; it defeats
+// the objective of this file:
+#ifdef BOOST_ASSERT_CONFIG
+# undef BOOST_ASSERT_CONFIG
+#endif
+
+#include
+#include "test.hpp"
+
+#ifdef BOOST_NO_RTTI
+#include "boost_no_rtti.ipp"
+#else
+#error "this file should not compile"
+#endif
+
+int main( int, char *[] )
+{
+ return boost_no_rtti::test();
+}
+
diff --git a/test/no_rtti_pass.cpp b/test/no_rtti_pass.cpp
new file mode 100644
index 00000000..9809213f
--- /dev/null
+++ b/test/no_rtti_pass.cpp
@@ -0,0 +1,37 @@
+// This file was automatically generated on Mon Aug 25 10:51:51 2008
+// by libs/config/tools/generate.cpp
+// Copyright John Maddock 2002-4.
+// 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)
+
+// See http://www.boost.org/libs/config for the most recent version.//
+// Revision $Id: generate.cpp 47351 2008-07-12 12:41:52Z johnmaddock $
+//
+
+
+// Test file for macro BOOST_NO_RTTI
+// This file should compile, if it does not then
+// BOOST_NO_RTTI should be defined.
+// See file boost_no_rtti.ipp for details
+
+// Must not have BOOST_ASSERT_CONFIG set; it defeats
+// the objective of this file:
+#ifdef BOOST_ASSERT_CONFIG
+# undef BOOST_ASSERT_CONFIG
+#endif
+
+#include
+#include "test.hpp"
+
+#ifndef BOOST_NO_RTTI
+#include "boost_no_rtti.ipp"
+#else
+namespace boost_no_rtti = empty_boost;
+#endif
+
+int main( int, char *[] )
+{
+ return boost_no_rtti::test();
+}
+