Date: Sun, 12 Sep 2004 15:16:14 -0500 From: "Jeremy Messenger" <mezz7@cox.net> To: freebsd-current@freebsd.org Subject: What's default value of -ftemplate-depth in GCC 3.4.2? Message-ID: <opsd8c9cor9aq2h7@mezz.mezzweb.com>
next in thread | raw e-mail | index | archive | help
Hello, I am not sure if I am right, but I have a feel that it is possible that GCC has forgotten to make the change in the document. Or, maybe someone change the GCC 3.4.2's default in FreeBSD? Current, in the document said that the default value is 17 but it looks like it's more than 17 to me. http://gcc.gnu.org/onlinedocs/gcc-3.4.1/gcc/C---Dialect-Options.html#C++%20Dialect%20Options ============================================= -ftemplate-depth-n Set the maximum instantiation depth for template classes to n. A limit on the template instantiation depth is needed to detect endless recursions during template class instantiation. ANSI/ISO C++ conforming programs must not rely on a maximum depth greater than 17. ============================================= I am working on the games/wesnoth update to 0.8.4 and it will fail build on FreeBSD 4.x w/ GCC 2.9x. But, it doesn't fail the build on FreeBSD 5.x w/ GCC 3.4.2. The error looks like this: ============================================= In file included from display.hpp:17, from font.hpp:19, from about.cpp:15: /usr/include/g++/stl_iterator.h: In function `void destroy<animated<unit_animation::frame,void_value<unit_animation::frame> >::frame *>(animated<unit_animation::frame,void_value<unit_animation::frame> >::frame *, animated<unit_animation::frame,void_value<unit_animation::frame> >::frame *)': /usr/include/g++/stl_iterator.h:154: template instantiation depth exceeds maximum of 17 /usr/include/g++/stl_iterator.h:154: (use -ftemplate-depth-NN to increase the maximum) /usr/include/g++/stl_iterator.h:154: instantiating `iterator_traits<animated<unit_animation::frame,void_value<unit_animation::frame> >::frame *>' [...goes on...] ============================================= So, I added the -ftemplate-depth-20 and it was insteresting that it will fail the build on FreeBSD 5.x w/ GCC 3.4.2 now. Changed it to 45 and it successed. So... This is what it makes me think that GCC team might have change something that is undocumented. Althought, I didn't check the changelog lower than 3.4.1. I don't know where the right place for me to check the default value of -ftemplate-depth. The developer of Wesnoth said that his source code doesn't has more than 10 template depth and said that FreeBSD 4.x's compiler has the bug... I am not sure if he is right, since if I put -ftemplate-depth-20 and it will fail on GCC 3.4.2 either. One more thing, how can I count the template depth in any source code? Cheers, Mezz -- mezz7 at cox.net - mezz at FreeBSD.org FreeBSD GNOME Team http://www.FreeBSD.org/gnome/ - gnome at FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opsd8c9cor9aq2h7>