我们正在使用PVS Studio(开源项目的免费变体)与travis-ci一起使用,由于某种原因,它会为位于json.children env.sites do |site|
json.nodeId "site_#{site.id}"
json.type "site"
json.extract! site,:id, :key, :name
json.children site.networks do |network|
json.nodeId "network_#{network.id}"
json.type "network"
json.extract! network,:id, :name
json.children network.vlans do |vlan|
json.type "vlan"
json.extract! vlan,:id, :name
end
end
json.children site.instances do |instance|
json.type "host"
json.extract! instance,:id, :name
json.content do
json.cpu instance.cpu
end
end
end
的文件产生错误:
/usr/local/clang-3.5.0/lib/clang/3.5.0/include/stddef.h:58:1: warning: V677 Custom declaration of a standard 'size_t' type. The declaration from system header files should be used instead. /usr/local/clang-3.5.0/lib/clang/3.5.0/include/stddef.h:86:1: warning: V677 Custom declaration of a standard 'wchar_t' type. The declaration from system header files should be used instead. /usr/local/clang-3.5.0/lib/clang/3.5.0/include/stdarg.h:30:1: warning: V677 Custom declaration of a standard 'va_list' type. The declaration from system header files should be used instead. /usr/local/clang-3.5.0/lib/clang/3.5.0/include/stddef.h:47:1: warning: V677 Custom declaration of a standard 'ptrdiff_t' type. The declaration from system header files should be used instead.
此位置看起来像是非标准编译器的“系统”标题的示例,并且远离项目根目录(AFAIR位于/ home中的某个位置:标准travis位置)。脚本运行使用https://www.viva64.com/en/pvs-studio-download-linux/的最新版本,最新版本为“Mon Jul 3 20:13:42 UTC 2017”(不幸的是,未使用的版本未保存)。
答案 0 :(得分:3)
如果编译器位于某个不寻常的位置,建议为分析器异常添加新路径,以便您在报告中只能看到自己项目代码的警告。
pvs-studio-analyzer analyze ... -e /path/to/exclude-path ...
或
pvs-studio ... --exclude-path /path/to/exclude-path ...
答案 1 :(得分:1)
如果clang更新为clang-4.0,PVS似乎没有检测到错误。