GCC7.1编译警告 parameter passing for argument of type ‘std::

编程入门 行业动态 更新时间:2024-10-24 21:28:53

GCC7.1编译警告 parameter <a href=https://www.elefans.com/category/jswz/34/1715484.html style=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::

本文发布于:2024-03-08 16:41:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1721477.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:passing   parameter   std   type   argument

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!