Boost logo

Boost-Commit :

From: jurko.gospodnetic_at_[hidden]
Date: 2008-07-23 12:49:20


Author: jurko
Date: 2008-07-23 12:49:19 EDT (Wed, 23 Jul 2008)
New Revision: 47727
URL: http://svn.boost.org/trac/boost/changeset/47727

Log:
Added a new c++-template-depth Boost Build feature allowing configuring compilers supporting this feature with the maximal template instantiation depth. Currently supported for gcc & qcc toolsets.
Text files modified:
   trunk/tools/build/v2/doc/src/reference.xml | 26 ++++++++++++++++++++++++++
   trunk/tools/build/v2/tools/builtin.jam | 28 ++++++++++++++++++++++++++++
   trunk/tools/build/v2/tools/gcc.jam | 4 +++-
   trunk/tools/build/v2/tools/qcc.jam | 5 ++++-
   4 files changed, 61 insertions(+), 2 deletions(-)

Modified: trunk/tools/build/v2/doc/src/reference.xml
==============================================================================
--- trunk/tools/build/v2/doc/src/reference.xml (original)
+++ trunk/tools/build/v2/doc/src/reference.xml 2008-07-23 12:49:19 EDT (Wed, 23 Jul 2008)
@@ -769,6 +769,32 @@
         </listitem>
       </varlistentry>
 
+ <varlistentry><term><literal>c++-template-depth</literal></term>
+ <indexterm><primary>64-bit compilation</primary></indexterm>
+ <listitem>
+ <para>
+ <emphasis role="bold">Allowed values:</emphasis> Any positive
+ integer.
+ </para>
+
+ <para>
+ This feature allows configuring a C++ compiler with the maximal
+ template instantiation depth parameter. Exact default values as well
+ as whether this feature is supported at all depend on the toolset
+ used.
+ </para>
+
+ <para>
+ <emphasis role="bold">Note:</emphasis> Due to some internal details
+ in the current Boost Build implementation it is not possible to have
+ features whose valid values are all positive integer. As a
+ workaround a large set of allowed values has been defined for this
+ feature and, if a different one is needed, user can easily add it by
+ calling the feature.extend rule.
+ </para>
+ </listitem>
+ </varlistentry>
+
     </variablelist>
   </section>
 

Modified: trunk/tools/build/v2/tools/builtin.jam
==============================================================================
--- trunk/tools/build/v2/tools/builtin.jam (original)
+++ trunk/tools/build/v2/tools/builtin.jam 2008-07-23 12:49:19 EDT (Wed, 23 Jul 2008)
@@ -15,6 +15,7 @@
 import errors : error ;
 import generate ;
 import generators ;
+import numbers ;
 import os ;
 import print ;
 import project ;
@@ -146,6 +147,33 @@
     on # Fail the compilation if there are warnings.
   : incidental propagated ;
 
+# Feature that allows us to configure the maximal template instantiation depth
+# level allowed by a C++ compiler. Applies only to C++ toolsets whose compilers
+# actually support this configuration setting.
+#
+# Note that Boost Build currently does not allow defining features that take any
+# positive integral value as a parameter, which is what we need here, so we just
+# define some of the values here and leave it up to the user to extend this set
+# as he needs using the feature.extend rule.
+#
+# If a specific toolset requires a default value for this feature other than the
+# one defined here it should set the feature's default value using the
+# feature.set-default rule.
+#
+# TODO: This should be upgraded as soon as Boost Build adds support for custom
+# validated feature values or at least features allowing any positive integral
+# value. See related Boost Build related trac ticket #194.
+#
+feature.feature c++-template-depth
+ :
+ [ numbers.range 128 1024 : 128 ]
+ [ numbers.range 20 1000 : 10 ]
+ # Maximum template instantiation depth guaranteed for ANSI/ISO C++
+ # conforming programs.
+ 17
+ :
+ incidental propagated ;
+
 feature.feature source : : free dependency incidental ;
 feature.feature library : : free dependency incidental ;
 feature.feature file : : free dependency incidental ;

Modified: trunk/tools/build/v2/tools/gcc.jam
==============================================================================
--- trunk/tools/build/v2/tools/gcc.jam (original)
+++ trunk/tools/build/v2/tools/gcc.jam 2008-07-23 12:49:19 EDT (Wed, 23 Jul 2008)
@@ -345,6 +345,8 @@
 flags gcc.compile.c++ USER_OPTIONS <cxxflags> ;
 flags gcc.compile DEFINES <define> ;
 flags gcc.compile INCLUDES <include> ;
+flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
+
 
 actions compile.c++.pch
 {
@@ -381,7 +383,7 @@
 
 actions compile.c++ bind PCH_FILE
 {
- "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
+ "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
 }
 
 actions compile.c bind PCH_FILE

Modified: trunk/tools/build/v2/tools/qcc.jam
==============================================================================
--- trunk/tools/build/v2/tools/qcc.jam (original)
+++ trunk/tools/build/v2/tools/qcc.jam 2008-07-23 12:49:19 EDT (Wed, 23 Jul 2008)
@@ -79,10 +79,13 @@
 
 flags qcc.compile OPTIONS <link>shared : -shared ;
 
+flags qcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
+feature.set-default c++-template-depth : 100 ;
+
 
 actions compile.c++
 {
- "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+ "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
 actions compile.c


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk