Page 1 of 1

Rename pow10 to allow gcc flag -Wshadow  Topic is solved

Posted: Wed Sep 20, 2023 5:21 pm
by albinhj

When enabling gcc compiler flag -Wshadow, I get this:

Code: Select all

stablChibiOS/os/hal/lib/streams/chprintf.c:78:19: warning: declaration of 'pow10' shadows a built-in function [-Wshadow]
   78 | static const long pow10[FLOAT_PRECISION] = {
      |                   ^~~~~

This is on Ubunutu, using
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)

By renaming this symbol, we can avoid this warning.

This applies to ]stablChibiOS/os/hal/lib/streams/chprintf.c, but seems to be the same in os/common/lib/src/chprintf.c. ( ... &type=code)

Many thanks and best regards