在VC++中查找引起警告4503的代码
find code causing warning 4503 in VC++
我正试图在一个大的代码库中找到这个大警告的来源:
C:Program Files (x86)Microsoft Visual Studio 12.VCINCLUDExmemory0(592) :
warning C4503:
'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_at' : decorated name length exceeded, name was truncated
with
[
_Kty=epmem_node_id,
_Ty=std::map<std::string,std::list<std::string,std::allocator<std::string>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::list<std::string,std::allocator<std::string>>>>>,
_Pr=std::less<epmem_node_id>,
_Alloc=std::allocator<std::pair<const epmem_node_id,std::map<std::string,std::list<std::string,std::allocator<std::string>>,std::less<std::string>, std::allocator<std::pair<const std::string,std::list<std::string,std::allocator<std::string>>>>>>>
]
我正计划放入以下内容以使其静音:
#pragma warning(push)
#pragma warning(disable:4503)
... code here
#pragma warning(pop)
然而,我一直把它放在代码库中,仍然会弹出警告。不幸的是,该警告没有指定问题所在的行、文件,甚至类或变量,所以我完全迷失了方向。我尝试使用dumpbin /ALL
,但当我搜索文件时,我在任何地方都找不到_Tree
。
如何在我的代码库中找到此警告的来源?
我的问题是如何找到导致问题的代码行,但这实际上并不能解决我的问题。由于有问题的代码涉及模板,cl
警告的修饰名称是在处理完翻译单元中的其余代码后生成的,因此我无法用warnings(push)
/warning(pop)
对包围任何给定的代码。
对我来说,解决方案是将#pragma warning(disable:4503)
放在文件的末尾(我将其放在include保护的#endif
之前)。这会使文件中使用tempaltes的结构生成的所有修饰名称的警告静音。warning(...)
杂注的作用域仅限于当前翻译单元,因此这不会影响任何其他文件。
相关文章:
- 警告处理为错误这里有什么问题
- 使用动态分配的数组会导致代码分析发出虚假的C6386缓冲区溢出警告
- cppcheck在const std::string[]上引发警告
- GCC对可能有效的代码抛出init list生存期警告
- 如何在BST的这个简单递归实现中消除警告
- 关于std::move的使用,是否有编译警告
- g++ 在某个类成员未初始化时不发出警告
- 如何处理来自核心指南检查器的关于gsl::at的静态分析警告
- 使用typeid警告未使用的变量
- 示例C++项目编译中的警告
- 警告:在函数返回类型 [-Wignore 限定符] 时忽略类型限定符
- 如何修复编译器警告 C6386 和 C6385?
- 返回语句后的代码,没有警告
- 获取隐式转换溢出从无符号到已签名的警告
- 编译器警告:执行到达值返回函数的末尾而不返回值
- 在未链接的部分上生成警告
- 警告 C4552:">>":未使用表达式的结果
- 禁止显示由于常量为零而比较始终为假的警告
- C++ 警告:将新创建的 gsl::owner<> 分配给非所有者
- 在VC++中查找引起警告4503的代码