通过铿锵声处理大量增压装置测试相关警告

时间:2016-12-23 21:14:32

标签: boost clang clang-static-analyzer boost-unit-test-framework clang-tidy

我正在建立一个项目。我使用升压单元测试进行了骨架测试。不幸的是,从宏扩展中产生了大量警告。有没有办法禁用这些,而不必指定单独的行号?。

即使我有一个// NOLINT,也会发生这种情况。

一个例子:

/home/peter/checkouts/canopen-gateway/./unittests/projs/server/exe/testunit-tcp-socket.cpp:12:1: warning: construction of 'end_suite12_registrar12' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
BOOST_AUTO_TEST_SUITE_END()  // NOLINT
^
/usr/include/boost/test/unit_test_suite.hpp:62:73: note: expanded from macro 'BOOST_AUTO_TEST_SUITE_END'
#define BOOST_AUTO_TEST_SUITE_END()                                     \
                                                                        ^
/usr/include/boost/test/unit_test_suite.hpp:209:62: note: expanded from macro '\BOOST_AUTO_TU_REGISTRAR'
static boost::unit_test::ut_detail::auto_test_unit_registrar BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ )
                                                             ^
/usr/include/boost/config/suffix.hpp:544:28: note: expanded from macro 'BOOST_JOIN'
#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
                           ^
/usr/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN'
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
                              ^
/usr/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2'
#define BOOST_DO_JOIN2( X, Y ) X##Y
                               ^
note: expanded from here
/usr/include/boost/test/unit_test_suite_impl.hpp:284:17: note: possibly throwing constructor declared here
    explicit    auto_test_unit_registrar( int );

1 个答案:

答案 0 :(得分:1)

您可能没有粘贴整个错误消息,但在某处应该有一行说明

  

警告:禁用递归宏的扩展   [-Wdisabled-宏扩展]

您可以通过将-Wno-disabled-macro-expansion传递给clang命令行来禁用此功能。