是否可以禁用外部库的 MISRA 检查?我已经尝试过了,但它似乎不起作用(此标头使用 C++ 样式注释和不兼容的 @ 标记)。
#pragma ghs startnomisra
#include <qcarcam.h>
#pragma ghs endnomisra
2018 年 10 月 4 日更新:最小示例
#pragma ghs startnomisra
#include <INTEGRITY.h>
#include <unistd.h>
#include <stdlib.h>
#pragma ghs endnomisra
int main(void)
{
const char* msg = "Hello world";
write(1, msg, strlen(msg));
Exit(0);
}
编译器输出:AFAIU 这些行与#pragmas 包含的包含相关
Output from Compiling stm-testbed_as0.c:
"/mnt/part2/apq8096au-hgh-1-0_hlos_dev_boot/ghs_apps_proc/integrity/INTEGRITY-include/INTEGRITY_types.h", line 226: error #20:
identifier "__inline" is undefined
static INLINE Value __LssbValue(Value TheValue)
^
"/mnt/part2/apq8096au-hgh-1-0_hlos_dev_boot/ghs_apps_proc/integrity/INTEGRITY-include/INTEGRITY_types.h", line 226: error #101:
"Value" has already been declared in the current scope
static INLINE Value __LssbValue(Value TheValue)
^
"/mnt/part2/apq8096au-hgh-1-0_hlos_dev_boot/ghs_apps_proc/integrity/INTEGRITY-include/INTEGRITY_types.h", line 226: error #65:
expected a ";"
static INLINE Value __LssbValue(Value TheValue)
^
"/mnt/part2/apq8096au-hgh-1-0_hlos_dev_boot/ghs_apps_proc/integrity/INTEGRITY-include/INTEGRITY_types.h", line 242: warning #12-D:
parsing restarts here after previous syntax error
typedef unsigned char MemoryLocation;
^
"/mnt/part2/apq8096au-hgh-1-0_hlos_dev_boot/ghs_apps_proc/integrity/INTEGRITY-include/time.h", line 67: fatal error #35:
#error directive: "(Misra Rule 20.12): the header <time.h> not
allowed"
# error "(Misra Rule 20.12): the header <time.h> not allowed"
^