I'm moving some code from 3.4.5 to 4.1.2 and I'm
getting a warning now that I can't figure out the
right way of removing. This was happy in 3.4.5:

  state_function_ptr = (void *)
   pgm_read_word( &menu_state[current_state_u8].FunctionPointer );

Now generates this warning in 4.1.2:

"ISO C forbids assignment between function pointer and `void *'"

Any other casts I've tried result in different warnings or errors,
and doing nothing tells me I'm assigning an integer to a
pointer with out a cast. :-(

static uint8_t (*state_function_ptr)(void);

typedef struct PROGMEM
{/* Function that will be called based on state table */
    uint8_t (*FunctionPointer)(void);
} MENU_STATE;

static uint8_t stf_error( void );
static uint8_t stf_error( void )
{/* We should never reach this state, but if we do display a message to indicate we got here: */
  /* Do something useful here */
  return( 0 );
}

static const MENU_STATE menu_state[] PROGMEM = {
    /* State Functions: */
    {stf_error},
...
};

How do I do this without generating error/warning messages?



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to