Some issues with array of pointers to functions

Royce Pereira <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CACzHkngXgemjPwcOJgaG-s-ERauaJ3BOpuM8026CP1p+LXK2Dg@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.