Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-07-19 16:18:29


   Hi Juergen.

   Thanks for the information.

   Here's a patch for the gcc.jam toolset module that should add the
template-depth feature you need.

   Please test it out and tell me if it does what you need.

   Note that Boost Build currently does not have support for cleanly
adding features allowing any positive integral number as its value (I
added a ticked for this at
https://zigzag.lvk.cs.msu.su:7813/boost.build/ticket/194) so I had to
implement smoe fixed set of allowed values. If you need any other value
you can easily call:

   feature.extend template-depth : 666 ;

   (replacing 666 with the value you need) in your Jamfile.

   Anyone else has any suggestions on this patch? Perhaps placing the
feature definition in a different module or renaming it to
gcc.template-depth? I though about placing it in the tools/builtin.jam
module but the feature is currently used only in the gcc toolset so I
decided against it.

   Rene, would it be ok to commit this patch? It's a clean feature
addition with no effect on Boost Build tests on Windows and cygwin and
does not break any of the Boost library tests I tries on Windows. Since
nothing else uses a feature with this name and the feature's default
value (128) is equal to the previously hard-coded value I do not see how
this could affect existing builds unless they defined their own
template-depth feature.

   If the patch is OK, I'll commit it and update the docs.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić

Index: tools/build/v2/tools/gcc.jam
===================================================================
--- tools/build/v2/tools/gcc.jam (revision 47586)
+++ tools/build/v2/tools/gcc.jam (working copy)
@@ -20,6 +20,7 @@
 import set ;
 import common ;
 import errors ;
+import numbers ;
 import property-set ;
 import pch ;
 import regex ;
@@ -72,6 +73,32 @@
 
 import rc ;
 
+
+# Here we define a <template-depth> feature specific to the gcc toolset. If it
+# becomes needed in other toolsets as well its definition should be moved to
+# tools/builtin.jam or some such similar module.
+#
+# Implementation notes:
+# 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.
+#
+# 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.
+#
+feature.feature 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 ;
+
+
 # Initializes the gcc toolset for the given version. If necessary, command may
 # be used to specify where the compiler is located. The parameter 'options' is a
 # space-delimited list of options, each one specified as
@@ -344,6 +371,7 @@
 flags gcc.compile.c++ USER_OPTIONS <cxxflags> ;
 flags gcc.compile DEFINES <define> ;
 flags gcc.compile INCLUDES <include> ;
+flags gcc.compile.c++ TEMPLATE_DEPTH <template-depth> ;
 
 actions compile.c++.pch
 {
@@ -380,7 +408,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


Boost-Build 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