[Insight-developers] -ftemplate-depth-50

Miller, James V (Research) millerjv@crd.ge.com
Tue, 4 Feb 2003 08:54:14 -0500


The increase in template depth is needed for ITK.  The default 
setting is too low for ITK. The template depth includes the
depth of a templated heirarchy, the depth of the templated 
classes used to instantiate a templated class (for instance
outer_templated_class<inner_templated_class<T> > ), and I believe
the template depth of an instance variable (and perhaps the depth
of any templated member function).  As far as I can tell, the 
"template depth" is not the maximum depth of any of the above
but the sum total of all the depths of the above.

Only the GNU compiler has this setting. It doesn't seem to 
affect compile times to increase it, so we usually increase it to 
a nice safe level.

Jim




> -----Original Message-----
> From: Hans J. Johnson [mailto:hans-johnson@uiowa.edu]
> Sent: Monday, February 03, 2003 8:20 PM
> To: insight-developers@public.kitware.com
> Subject: [Insight-developers] -ftemplate-depth-50
> 
> 
> Hello,
> 
> I am trying to compile an application that links against the ITK
> libraries.  I have specified that the toolkit is to use the following
> compiler flags for both the ITK libraries and my application:
> "-g -fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual 
> -Wstrict-prototypes". 
> The problem occurs when I attempt to compile my application I get the
> following cmake error:
> "SEND_WARNINGThe selected ITK was built with C++ compiler flags " -g
> -fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual -Wstrict-prototypes
> -ftemplate-depth-50", but the current flags are " -g -fstrict-aliasing
> -UNDEBUG  -Wall -Wcast-qual -Wstrict-prototypes".  Please set
> CMAKE_CXX_FLAGS to " -g -fstrict-aliasing -UNDEBUG  -Wall -Wcast-qual
> -Wstrict-prototypes -ftemplate-depth-50"."
> 
> I have noticed that the confounding compiler option 
> -ftemplate-depth-50
> is defined in Insight/itkCMakeOptions.cmake.  
> 
> 1) Is this flag really needed?  Do other compilers require similar
> flags? 
>  -ftemplate-depth-n
>    Set the maximum instantiation depth for template classes to n.  A
>    limit on the template instantiation depth is needed to detect end-
>    less recursions during template class instantiation.  ANSI/ISO C++
>    conforming programs must not rely on a maximum depth greater than
>    17.
> 
> 2)  Do all applications require a CmakeOptions.cmake file with
> IF(CMAKE_COMPILER_IS_GNUCXX)
>   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-50")
>   IF(APPLE)
>     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
>   ENDIF(APPLE)
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
> in it?
> 
> 
> 
> Thanks, 
> Hans J. Johnson
> hans-johnson@uiowa.edu
> 
> 
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>