Hi!

This is my problem:

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,       
         {0, 16, NULL},
         (bits32)4
      };

Splint complains:

Module2.c:12:10: Initial value of Command_C[0].AdditionalInfo is type
    bits32, expects union { void * NoData; bits32 Constant;
    Module_Field_T Field; }: (bits32)4
  Types are incompatible. (Use -type to inhibit warning)

Setting the union value to NULL will not cause this complaint.

What do I do to prevent splint from typechecking the union within the struct
or is there a better solution out there?
Thankful for any information.

/Emma
---------------------------------------------------------------
Emma Wermström   
Software Engineer
Saab Ericsson Space AB          tel: 031-7354433 
S-405 15  Goteborg              mobil: 0708-375230
SWEDEN                          mail: [EMAIL PROTECTED]
--------------------------------------------------------------

Reply via email to