[splint-discuss] Code for embedded processor

Oliver Betz list_ob at gmx.net
Wed Apr 23 06:06:19 EDT 2003


F.Giavarini at cobra.it wrote:

> typedef union
> {
>     unsigned char BYTE;
>     struct
>     {
>         unsigned char PA0:1;

[...]

AFAIK, char is not allowed in bitfields (another "embedded" 
peculiarity).

> @tiny volatile  PADR_H   _PADR       @0x00;     /* Port A Data Register */

[...]

> The compiler that I'm using recognize the modifier @tiny and @0x00 in order
> to assign one specific memory location.
> I don't know how to tell Splint to ignore this kind of indications.

BTW: You might have a look at the archives of this list. Four weeks 
ago there was the last thread about this topic, and there were many 
other threads.

You have to hide both from Splint. Roland showed how to do it for 
@tiny. For the second, use something like #define PORT(x) @(x).

You might encounter problems also for constant assignments to char 
variables, e.g. unsigned char foo; foo = 1; results in "Assignment of 
int to unsigned char". No satisfactory solution available for this.

Harder to hide are assembler blocks (#pragma asm/#pragma endasm), the 
Splint parser can't handle it.

Maybe you look at PC-Lint, commercial (220EUR) capable of handling 
non-ANSI-stuff of nearly all compilers, and also checking for MISRA 
rules, indentation and much more... I finally bought it for my 
commercial work but still had no time to make extensive tests.

Oliver
-- 
Oliver Betz, Muenchen




More information about the splint-discuss mailing list