Emma Wermstrom wrote:
> 
> At 16:34 2002-06-21 -0400, CBFalconer wrote:
> >Emma Wermstrom wrote:
> >>
> >> In the module, Module.h file, I have declared the following:
> >>
> >> typedef /*@abstract@*/ struct _Module_Cmd_T {
> >>
> >>    Module_Type_T Type; /* enum */
> >>    Module_Info_T Info; /* struct */
> >>    union {
> >>
> >>       /*@NULL@*/ void * const               NoData;
> >>
> >>       bits32                                Constant;
> >>
> >>       /*@NULL@*/ const Module_Field_T Field;
> >>    } AdditionalInfo;
> >> } Module_Cmd_T;
> >>
> >> where Module_Field_T, Module_Info_T and Module_Type_T have previously been
> >> declared in Module.h
> >>
> >> bits32 is an unsigned long
> >>
> >> In another module, Module2, I try to give a value to an instance of the
> >> Module_Cmd_T, like this:
> >>
> >> #include "Module.h"
> >> /*@access Module_Cmd_T@*/
> >>
> >> static const Module_Cmd_T pm Command_C[1]       =
> >>       {
> >>          Module_Type_foo,    /*Module_Type_T Type*/
> >
> >  Doesn't the info field belong here ??
> >
> 
>    No, the info-field is specified in the next line: {0, 16, NULL}. It's a
> struct.
> 
> >>          {0, 16, NULL},     /*Module_Info_T  Info*/
> >>          (bits32)4          /*union*/
> >>       };

Your declaration for the thing has three fields:

   1.   Module_Type_t named Type
   2.   Module_Info_T named Info (which is a struct)
   3.   A union named AdditionalInfo. (of which only the first
field can be initialized and requires a void*, not a bits32)

I think. You never showed the declaration of Module_Info_T. 
However I have found several completely valid constructs that
splint barfs on, so I am starting to treat its warnings with
suspicion.  What does gcc do with it, and have you tried pclint? 
After correcting the union initialization.

-- 
Chuck F ([EMAIL PROTECTED]) ([EMAIL PROTECTED])
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


Reply via email to