[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Some issues with array of pointers to functions
From: |
Royce Pereira |
Subject: |
[avr-gcc-list] Some issues with array of pointers to functions |
Date: |
Fri, 13 Jun 2014 15:36:21 +0530 |
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] Some issues with array of pointers to functions,
Royce Pereira <=