global variable name "ch" shadow with MDMA Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
alex31
Posts: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 times
Contact:

global variable name "ch" shadow with MDMA  Topic is solved

Postby alex31 » Tue Jun 08, 2021 9:58 am

Hello,

When I compile mdma module (STM32H7, stable_20.3.x) with current gcc 10.2 compiler , -Wshadow flag, I meet this error :

../../../ChibiOS_20.3_stable/os/hal/ports/STM32/LLD/MDMAv1/stm32_mdma.c: In function 'mdmaInit':
../../../ChibiOS_20.3_stable/os/hal/ports/STM32/LLD/MDMAv1/stm32_mdma.c:168:39: error: declaration of 'ch' shadows a global declaration [-Werror=shadow]
168 | static MDMA_Channel_TypeDef * const ch[STM32_MDMA_CHANNELS] = {
| ^~
In file included from ../../../ChibiOS_20.3_stable/os/rt/include/ch.h:116,
from ../../../ChibiOS_20.3_stable/os/hal/osal/rt-nil/osal.h:32,
from ../../../ChibiOS_20.3_stable/os/hal/include/hal.h:28,
from ../../../ChibiOS_20.3_stable/os/hal/ports/STM32/LLD/MDMAv1/stm32_mdma.c:32:
../../../ChibiOS_20.3_stable/os/rt/include/chschd.h:469:20: note: shadowed declaration is here
469 | extern ch_system_t ch;
| ^~


I can circumvent the error with removing -Wshadow from Makefile, but it's sometime useful to find bugs.

Alexandre

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: global variable name "ch" shadow with MDMA

Postby Giovanni » Tue Jun 08, 2021 11:34 am

Hi,

That variable has been renamed in latest code, I will also change it in 20.x.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 15 guests