尽管 -isystem 仍生成警告

Warnings generated despite -isystem

我们在编译我们的一个应用程序时使用了两个框架,Beast 和 Boost。在 Beast 使用的某些 Boost 代码中,g++ 会生成警告,因为它认为可能存在未初始化的变量。但是,我们使用“-isystem”标志包括 boost 和 beast。这应该会阻止显示警告,但事实并非如此。有什么想法吗?

下面你可以看到编译命令及其输出,有一些匿名。

/home/user/code/thirdparty/supplier/6.0/sysroots/x86_64-suppliersdk-linux/usr/bin/arm-supplier-linux-gnueabi/arm-supplier-linux-gnueabi-g++ --sysroot=/home/user/code/thirdparty/supplier/6.0/sysroots/armv7a-neon-supplier-linux-gnueabi -DBOOST_ASIO_DISABLE_EPOLL=1 -DEIGEN_MPL2_ONLY -DUSE_LOG -DLOG_THROUGH_SERVERSERVICE=1 -DARM -DNDEBUG -DAPP_TYPE_IS_PT -DOSIRIS_RELEASE_NUMBER=\"0.0\" -DLOGCONFIGFILE=\"app1_dev.log4\" -DCONFIGFILE=\"app1_native.cfg\" -DCONFIGFILE=\"app1_native.cfg\" -DLOGCONFIGFILE=\"app1_dev.log4\" -pthread  -std=c++11  -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -O2 -ftree-vectorize -ffast-math -Wall -Wextra -Wno-unused-parameter  -Wcast-align  -Wuninitialized -Wmissing-include-dirs -Wpedantic -I binaryprotocol/include -I common/include -I config/include -I connectivity/include -I core/include  -I socketserver/include -isystem /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include -isystem /home/user/code/thirdparty/log4cplus/1.2.0/arm/b993705d/include -isystem /home/user/code/thirdparty/openssl/1.0.2j/arm/b993705d/include -isystem ../external/common/modernjson -isystem ../external/common/pstreams -isystem ../external/common/beast/include -MD -MF ../osiris-obj/arm/b993705d/mains/app1/TLSWSClient.d -c mains/app1/TLSWSClient.cpp -o ../osiris-obj/arm/b993705d/mains/app1/TLSWSClient.o
In copy constructor ~boost::asio::detail::consuming_buffers<Buffer, Buffers>::consuming_buffers(const boost::asio::detail::consuming_buffers<Buffer, Buffers>&) [with Buffer = boost::asio::const_buffer; Buffers = beast::detail::buffer_cat_helper<beast::http::detail::chunk_encode_delim, boost::asio::null_buffers, boost::asio::const_buffers_1>]~:
cc1plus: warning: ~*((void*)& second +8)~ may be used uninitialized in this function [-Wmaybe-uninitialized]
In file included from /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio/impl/write.hpp:23:0,
                 from /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio/write.hpp:618,
                 from /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio/buffered_write_stream.hpp:29,
                 from /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio/buffered_stream.hpp:22,
                 from /home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio.hpp:38,
                 from ../external/common/beast/include/beast/websocket/stream.hpp:18,
                 from ../external/common/beast/include/beast/websocket.hpp:14,
                 from mains/app1/TLSWSClient.h:13,
                 from mains/app1/TLSWSClient.cpp:11:
/home/user/code/thirdparty/boost/1.64.0/arm/b993705d/include/boost/asio/detail/consuming_buffers.hpp:191:38: note: ~*((void*)& second +8)~ was declared here
     typename Buffers::const_iterator second = other.begin_remainder_;

运行 Ubuntu 16.04。 g++ 由供应商提供,其版本如下。

/home/user/code/thirdparty/supplier/6.0/sysroots/x86_64-suppliersdk-linux/usr/bin/arm-supplier-linux-gnueabi/arm-supplier-linux-gnueabi-g++ --version
arm-supplier-linux-gnueabi-g++ (GCC) 5.3.0

"-i" 并不总是阻止所有警告。有一段时间 gcc 为 "maybe uninitialized." 产生了误报,这看起来就像其中一个时期。