Mike
Mike

Reputation: 4288

How could PC-Lint ignore an expression or macro

I have got a xc8 program where I predefine the EEPROM:

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

Know I like PC-Lint to ignore such an expression in all my files.

Upvotes: 0

Views: 1021

Answers (2)

evilfranky
evilfranky

Reputation: 36

A possible way would be adding following to a .lnt file

// 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

Upvotes: 2

user50619
user50619

Reputation: 353

You should be able to find a MACRO defined by your LINT program that will allow some conditional compilation. Using SPLINT for instance, you could make it ignore __EEPROM calls by using

 /*
  * 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

That way you can use all the checking of split without getting warnings about the xc8/PIC specific code.

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

Upvotes: 0

Related Questions