Cppcheck:MISRA 缺少配置和内部错误

问题描述 投票:0回答:1

我正在使用 cppcheck 扩展与 VSCode 进行 MISRA 静态分析。

这是我的 platform.ini 命令行:

check_tool = cppcheck
check_flags =
    cppcheck: --addon=./scripts/misra.json --addon=cert --addon=threadsafety --addon=y2038 --suppress=*:*stm32l0xx_hal.c

我从这里

添加了MISRA标题txt文件

我还从官方仓库

获取了 MISRA 插件脚本

在 powershell 中运行

pio check
时,我收到以下一组错误:

[high:error] Because of missing configuration, misra checking is incomplete. There can be false negatives! Unknown array size, please review configuration [misra-config]
src\main.c:0:[high:error] Bailing out from checking since there was an internal error: Failed to execute 'C:\.platformio\penv\Scripts\python.exe C:\\.platformio\packages\tool-cppcheck\addons\runaddon.py scripts\misra.py --cli --rule-texts=scripts/misra2018.txt C:\PlatformIO\Projects\L010_test\src\main.c.18884.dump'. {file: C:/.platformio/packages/framework-stm32cubel0/Drivers/CMSIS/Include/cmsis_gcc.h, linenr: 181, column: 50, severity: style, message: A function should not contain unused parameters\t, addon: misra, errorId: c2012-2.7, extra: Advisory} [internalError]

配置文件中有什么需要做的吗?虽然我找不到

misra-config

有人可以帮我理解这个错误或者我在这里可能做错了什么吗?

c embedded static-analysis misra cppcheck
1个回答
0
投票

misra-config 是当代码中存在未知内容时由 Misra 插件编写的。通常,Cppcheck 不会看到一些声明。一个可能的解决方案是提供更多 -I 或 -D 标志。

这不是代码中的问题,而是 Cppcheck 配置中的问题。

© www.soinside.com 2019 - 2024. All rights reserved.