正如标题所说,是否有编译器日志记录设置,它提供编译期间编译器达到的最大瞬时deph?
如果编译超出了最大模板deph(在C++ 11模式下哪个GCC的默认值为900),则编译失败.但我需要的是获得编译器在成功编译期间达到的最大模板即时深度.
g++ 确实有这样的选项,但默认情况下它没有在kubuntu上启用.
以下是gcc/cp/tree.c来自gcc-4.8.1(并因此根据GPL许可)的一部分:
void
cxx_print_statistics (void)
{
print_search_statistics ();
print_class_statistics ();
print_template_statistics ();
if (GATHER_STATISTICS)
fprintf (stderr, "maximum template instantiation depth reached: %d\n",
depth_reached);
}
Run Code Online (Sandbox Code Playgroud)
您可以在添加-fdump-statistics -fstats到命令行时获取这些统计信息,但 GATHER_STATISTICS必须在编译时启用gcc,因此您可能必须重建gcc才能获得所需的功能.
| 归档时间: |
|
| 查看次数: |
192 次 |
| 最近记录: |