I'm trying to understand the splint message that we are receiving in some 
legacy code.  The code compiles successfully without any warnings.

Code:
#define string_parse_type(field,value) char field[sizeof(value)]

struct strStruct
{
    string_parse_type(s1,"string1");
    string_parse_type(s2,"str2");
} mystrs = {
    "string1",
    "str2"
};

Splint warning:
test.c:8:5: String literal with 8 characters (counting null terminator)
   is assigned to char [0] (insufficient storage available): "string1"
   A string literal is assigned to a char array too small to hold it. (Use
   -stringliteraltoolong to inhibit warning)
test.c:9:5: String literal with 5 characters (counting null terminator)
   is assigned to char [0] (insufficient storage available): "str2"
Finished checking

Why does splint think the char arrays have a dimension of 0?  How can I make 
splint happy with this code?

Thanks,
Jeff Harris
_______________________________________________
splint-discuss mailing list
splint-discuss@mail.cs.virginia.edu
http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

Reply via email to