passing for argument of type ‘std::"/>
GCC7.1编译警告 parameter passing for argument of type ‘std::
最近在新的编译器上移植编译代码时,发现出现了一个未曾见过的警告,这套代码在之前其他编译器上是0警告的。
/opt/linux/x86-arm/arm-mix410-linux/arm-linux-gnueabi/include/c++/7.3.0/bits/stl_tree.h:1125:14: note: parameter passing for argument of type ‘std::_Rb_tree<std::__cxx11::basic_string, std::pair<const std::__cxx11::basic_string, _bb808_ftp_task>, std::_Select1st<std::pair<const std::__cxx11::basic_string, _bb808_ftp_task> >, std::less<std::__cxx11::basic_string >, std::allocator<std::pair<const std::__cxx11::basic_string, _bb808_ftp_task> > >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::__cxx11::basic_string, _bb808_ftp_task> >}’ changed in GCC 7.1
_M_erase_aux(__position);
搜索代码问题所在处,发现是调用 std::map 的成员函数 erase 引起的,搜索资料
有人曾提起类似这样的问题,并得到这样的回复
该警告告诉您,在6和7.1之间有一个细微的ABI变化(实际上是一致性修复),因此当从使用7.x构建的代码调用时,
使用6.x或更早版本构建的库可能无法正常工作(反之亦然)。
只要您的所有C++代码都是使用GCC 7.1或更高版本构建的,您就可以放心地忽略此警告。要禁用它,请将-Wno-psabi传递给编译器。
在Makefile中添加编译参数 -Wno-psabi 可以关闭该警告信息。
对本人来说不存在不同编译器编译出来的库互相使用导致的兼容性问题,所以选择忽视该警告信息。
更多推荐
GCC7.1编译警告 parameter passing for argument of type ‘std::
发布评论