Hi all,

Continuing with the latest avr-gcc, and playing with the new '__flash'
qualifier, I'm facing some new warnings, not seen before.

I have this:
//===================
void func1(void)
   {
      //........
   }
//===================
void func2(void)
   {
      //........
   }
//===================
void func3(void)
   {
      //........
   }
//===================

__flash void (*funcArray[])(void) = { func1, func2, func3 } ;

//====================
unsigned char funcNo;

int main(void)
    {
       //...code that sets 'funcNo'

       (funcArray[funcNo])() ;  //call the desired function from the array.

       return 0 ;
    }
//============================
/*
No error is thrown and the code runs fine on the target board too.

But I get the following warnings, and I don't know why :

warning: initialization from incompatible pointer type [enabled by default]
{ func1, func2, func3 } ;
  ^

warning: (near initialization for 'funcArray[0]') [enabled by default]
warning: initialization from incompatible pointer type [enabled by default]
warning: (near initialization for 'funcArray[1]') [enabled by default]
warning: initialization from incompatible pointer type [enabled by default]
warning: (near initialization for 'funcArray[2]') [enabled by default]
warning: initialization from incompatible pointer type [enabled by default]

 In function 'main':
warning: function with qualified void return type called [enabled by default]
    (funcArray[funcNo])() ;

*/

Can anyone give me an idea of what's happening and how to get rid of
the warnings ?

Thank You !                             ^

-- 
Best Regards,

-- Royce Pereira

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

Reply via email to