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
Posts: 343
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 34 times
Been thanked: 51 times

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

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


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.


User avatar
Site Admin
Posts: 13629
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 888 times
Been thanked: 768 times

Re: global variable name "ch" shadow with MDMA

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


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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 6 guests