I have an existing C-code (3rd party source, I can't change it) which will not be accepted by PC-Lint (Version 9.0). The code is running in an embedded environment, Green Hills Compiler is used.
Has anyone know-how on how to configure PC-Lint to accept the code definition? I have attached only the error message for the first member in the struct.
Here are the defines from header file:
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 ';'
An excerpt from the PC-lint FAQ:
How do I tell lint not to complain about my compiler headers?
Lint uses the label of "library" header to designate those headers over which a programmer has no control (such as compiler headers). By default all #includes from a foreign directory, or enclosed within < > , are considered "library." This can be modified through the use of the
+libclassoption, and further fine-tuned with the+/-libdirand+/-libhoptions.
You can then use the-wlib,-eliband-elibsymoptions to control just those messages being emitted from library headers. Compiler options files distributed with PC-lint usually contain a-wlib(1)option which limits lint output from library headers to errors only (suppressing warning and informational messages).
I guess, that should fit your needs. If not, a minimal example that reproduce your warnings would be nice; the stuff above riddles me, since the #define of PINSEL0 is after its use as identifier in the struct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With