PC-Lint如何忽略表达式或宏

时间:2018-07-06 07:14:15

标签: c xc8 pc-lint

我有一个预定义EEPROM的xc8程序:

__EEPROM_DATA (1, 2, 3, 4, 5, 6, 7, 8);

知道我希望PC-Lint在所有文件中都忽略这样的表达式。

2 个答案:

答案 0 :(得分:2)

一种可能的方法是在.lnt文件中添加以下内容

// activate _to_semi keyword
+rw(_to_semi)

// assign __EEPROM_DATA to "_to_semi" expression that means everything from 
// "__EEPROM_DATA" until the next ";" will be ignored by PC-Lint             
-d__EEPROM_DATA=_to_semi

答案 1 :(得分:0)

您应该能够找到由您定义的MACRO LINT程序,将允许一些条件编译。 例如,使用SPLINT,可以使其忽略__EEPROM调用 通过使用

 /*
  * definitions to ease splint checking in non xc8 compiler.
  */
#ifndef S_SPLINT_S
  __EEPROM_DATA (1, 2, 3, 4, 5, 6, 7, 8);
  __EEPROM_DATA (1, 2, 3, 4, 5, 6, 7, 8);
  __EEPROM_DATA (1, 2, 3, 4, 5, 6, 7, 8);
#endif

这样,您可以使用所有拆分检查,而不会收到有关 xc8 / PIC专用代码。

http://www.splint.org/manual/html/sec14.html