我有一個現有的C代碼(第三方來源,我無法更改它),這將不會被PC-Lint(版本9.0)接受。代碼在嵌入式環境中運行,使用Green Hills Compiler。使用直接寄存器尋址時出現PC-Lint錯誤
有沒有人知道如何配置PC-Lint接受代碼定義? 我只附加了結構中第一個成員的錯誤消息。
下面是從頭文件中的定義:
typedef struct
{
uint32_t PINSEL0; // see ERROR message from PCLint, line 153 in LPC23.h
uint32_t PINSEL1;
uint32_t PINSEL2;
} LPC_PINCON_TypeDef;
#define LPC_PINCON_BASE (0xE002C000)
#define LPC_PINCON ((LPC_PINCON_TypeDef *) LPC_PINCON_BASE)
#define PINSEL_BASE_ADDR 0xE002C000
#define PINSEL0 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x00))
/**************************/
/* function in c-file */
void Port_Init()
{
LPC_PINCON->PINSEL0 &= ~(3 << 4); //p0.2
LPC_PINCON->PINSEL0 |= (1 << 4); //
LPC_PINCON->PINSEL0 &= ~(3 << 6); //p0.3
LPC_PINCON->PINSEL0 |= (1 << 6); //
// etc................
}
/*******************************************/
// ERRORS from PC-Lint
// **********ERROR MESSAGES**************
#... (volatile unsigned long *)(PINSEL_BASE_ADDR + 0x00))
uint32_t PINSEL0;
LPC23.h 153 Error 10: Expecting identifier
#... BASE_ADDR + 0x00))
uint32_t PINSEL0;
LPC23.h 153 Error 102: Illegal parameter specification
#... BASE_ADDR + 0x00))
uint32_t PINSEL0;
LPC23.h 153 Error 10: Expecting ';'
爲什麼你根本不使用lint,什麼時候你不想改變代碼?它不是一個編譯器,而是一個分析器。 – Matthias 2012-02-27 14:58:24
SW-項目由第三方代碼(我不想更改)和自己編寫的代碼組成。如果有可能,我只想爲我自己的書面代碼提供lint錯誤。 – user1235613 2012-02-27 16:04:42