[hatari-devel] How to remove this warning ?

Thomas Huth huth at users.berlios.de
Sat Aug 22 20:04:11 CEST 2009


On Sat, 22 Aug 2009 12:11:53 +0200
Laurent Sallafranque <laurent.sallafranque at free.fr> wrote:

> Hello,
> 
> In my xxx.h , I've written :
> 
> typedef struct hd6301_opcode_t {
>     Uint8    op_value;            /* Opcode value */
>     Uint8    op_bytes;            /* Total opcode bytes */
>     void    (*op_func)(void);        /* Function that "executes"
> opcode */ Uint8    op_n_cycles;            /* Number of clock cycles
> */ const char *op_mnemonic;        /* Printout format string */
>     void    (*op_func_disasm)(void);    /* Function that "executes" 
> disasm opcode */
> };
> 
> 
> When I compile, I've got the following message :
> 
> hd6301_cpu.h:63: warning : useless storage class specifier in empty 
> declaration
> (Line 63 is the last line of the definition of the struct " }; "
> 
> What is it and how can I remove the warning ?

Simply omit the keyword "typedef". You don't declare a type here, you
declare a struct.
The alternative would be to declare a new type like this:

typedef struct  {
...
} hd6301_opcode_t;

Here the hd6301_opcode_t is at the end, the name of the new type. In
that case you don't have to use the "struct" keyword anymore when you
later specify the opcode list.

 Thomas



More information about the hatari-devel mailing list