GDISP: Move extern GDISPVMT declarations outside of function body

This prevents generation of "nested-externs" compiler warnings.
develop
Joel Bodenmann 2021-08-13 11:51:47 +02:00
parent 37450998e1
commit cf01cb2e7c
1 changed files with 10 additions and 6 deletions

View File

@ -555,6 +555,14 @@ static void line_clip(GDisplay *g) {
/* Driver exported functions. */
/*===========================================================================*/
// Gather GDISP VMT(S)
// These are only needed in _gdispInit(). However, we want to prevent generating nested-externs compiler warnings.
#if defined(GDISP_DRIVER_LIST)
extern GDISPVMTLIST GDISP_DRIVER_LIST;
#else
extern const GDISPVMT GDISPVMT_OnlyOne[1];
#endif
void _gdispInit(void)
{
// GDISP_DRIVER_LIST is defined - create each driver instance
@ -563,7 +571,6 @@ void _gdispInit(void)
unsigned i;
typedef const GDISPVMT const GDISPVMTLIST[1];
extern GDISPVMTLIST GDISP_DRIVER_LIST;
static const GDISPVMT * const dclist[] = {GDISP_DRIVER_LIST};
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
@ -574,7 +581,6 @@ void _gdispInit(void)
#elif GDISP_TOTAL_DISPLAYS > 1
{
unsigned i;
extern const GDISPVMT GDISPVMT_OnlyOne[1];
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) {
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
@ -583,8 +589,6 @@ void _gdispInit(void)
}
#else
{
extern const GDISPVMT GDISPVMT_OnlyOne[1];
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY))
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
}