我正在尝试将Clang的分析器插入一个大项目的现有构建系统中。我已经取得了相当大的进步,但有一点令人恼火的是:
/var/fpwork/boost_1.46.1/boost/thread/pthread/condition_variable.hpp:53:19: warning: Value stored to 'res' during its initialization is never read
int const res=pthread_cond_wait(&cond,&internal_mutex);
^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/fpwork/boost_1.46.1/boost/thread/pthread/condition_variable.hpp:53:19: note: Value stored to 'res' during its initialization is never read
int const res=pthread_cond_wait(&cond,&internal_mutex);
^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
很明显,这是一个不是源于我们的代码的警告,只是在Boost源代码中,由include引入。我如何告诉Clang忽略这些,或者,如何有效地过滤掉那里产生的所有警告?
我听说过__clang_analyzer__
宏,但我不想改变整个代码库只是为了方便地运行Clang的分析器。
编辑:我确实认为这主要不是Boost通常生活的道路;无论如何我都会留下boost。