In the framework there is a structure like this:
Code: Select all
typedef struct WidgetSlots
{
union
{
void(*Table[3])(void *context);
struct
{
// Pointers to slot functions
void(*Fcn_A)(void *context);
void(*Fcn_B)(void *context);
void(*Fcn_C)(void *context);
};
};
} WidgetSlots;
Code: Select all
static void Widget_Fcn_A(void *context)
{
//pending
}
static void Widget_Fcn_B(void *context)
{
//pending
}
static void Widget_Fcn_C(void *context)
{
//pending
}
void setup() {
// put your setup code here, to run once:
static WidgetSlots s_Raised__Slots = {
(void(*)(void *))Widget_Fcn_A,
(void(*)(void *))Widget_Fcn_B,
(void(*)(void *))Widget_Fcn_C,
};
}
To get around I could add two more brace pairs to pass the IDF compiler. Code as below will compile in IDF.
Code: Select all
// put your setup code here, to run once:
static WidgetSlots s_Raised__Slots = {{{
(void(*)(void *))Widget_Fcn_A,
(void(*)(void *))Widget_Fcn_B,
(void(*)(void *))Widget_Fcn_C,
}}};
Another peculiar thing is, single brace initialization is working in ESP32 arduino. I am wondering if there is any switch or standard that I can apply to Cross GCC in ESP32 IDF such that initialization with single brace pair works?
Look forward to any suggestion.
John