[splint-discuss] Parse Error on Macro, help

raymond raymond-xu at 126.com
Tue Sep 5 23:03:48 EDT 2006


I write a simple C program with a Macro like below:

/*test.c*/
  1 #include<unistd.h>
  2 #include<stdio.h>
  3 #include <stdlib.h>
  4 #define MSG_COMMON_HEADER()                     \
  5         u_int16_t len;                          \
  6         u_int16_t type;
  7
  8 struct any_msg {
  9           MSG_COMMON_HEADER ();
 10 };
 11
 12 int main( int argc , char** argv)
 13 {
 14         struct any_msg msg = {
 15                 .type = 0,
 16                 .len = 4};
 17         printf( "msg.type = %d msg.len = %d\n", msg.type,msg.len);
 18         return 0;
 19 }

Using the splint cmd:
	splint +posixlib macro_splint.c
it outputs:
	
        Splint 3.1.1 --- 06 Jan 2006
        
        macro_splint.c:9:13: Parse Error. (For help on parse errors, see
        splint -help
                       parseerrors.)
        *** Cannot continue.
It seems like splint can't parse the MSG_COMMON_HEADER() macro.

Has anyone met this problem?

Thanks a lot




More information about the splint-discuss mailing list