|
Boost-Build : |
From: Jurko GospodnetiÄ (jurko.gospodnetic_at_[hidden])
Date: 2008-07-20 13:32:52
Hi Ilya.
> From
> http://www.qnx.com/developers/docs/6.3.2/neutrino/utilities/q/qcc.html
Thank you for the information!
Here is an updated patch. It makes both gcc & qcc toolsets use the
new template-depth.patch which is now defined in the tools/builtin.jam
module.
Could someone (Joel? Jurgen? Ilya?) please test them on their
intended toolsets (gcc/qcc) and let me know if it is ok? I tested them
on Windows and they do make gcc & qcc toolsets generate command-lines as
I expected them to.
I'll update the documentation if the feature is ok. I contacted Rene
on IRC and he said we are ok to commit this as long as the change does
not modify any of the command-lines constructed by Boost Build when the
new template-depth feature is not used.
Note that the feature is still passed to compiler actions using a
separate TEMPLATE_DEPTH flag instead of being packed into the more
generic OPTIONS flag. In the gcc module this allows us not to change any
of the actual command line options used when this template-depth feature
is not used, thus not risk breaking a Boost library build or test run
breaking this close to the release.
Another reason why this was left implemented this was is that Boost
Build does not allow me, or I have not figured out how to do it without
modifying Boost Build itself, to add a flag that constructs its value
partly from a hardcoded string (e.g. -ftemplate-depth-) and partly from
a feature's value. I'll add a ticked for this but I do not believe it is
such a bug deal. The only thing I can see having this support would
allow us is to possibly clean up some duplication between similar
actions like compile.c++ & compile.c++.pch in gcc but this does not seem
to be such a big problem anyway. Neither is that code often touched nor
are there many such 'duplicated actions'.
Hope this helps.
Best regards,
Jurko GospodnetiÄ
Index: tools/build/v2/tools/builtin.jam
===================================================================
--- tools/build/v2/tools/builtin.jam (revision 47631)
+++ tools/build/v2/tools/builtin.jam (working copy)
@@ -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 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 ;
Index: tools/build/v2/tools/gcc.jam
===================================================================
--- tools/build/v2/tools/gcc.jam (revision 47638)
+++ tools/build/v2/tools/gcc.jam (working copy)
@@ -345,7 +345,9 @@
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
{
"$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
@@ -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
Index: tools/build/v2/tools/qcc.jam
===================================================================
--- tools/build/v2/tools/qcc.jam (revision 47639)
+++ tools/build/v2/tools/qcc.jam (working copy)
@@ -79,10 +79,13 @@
flags qcc.compile OPTIONS <link>shared : -shared ;
+flags qcc.compile.c++ TEMPLATE_DEPTH <template-depth> ;
+feature.set-default 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-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