Rename pow10 to allow gcc flag -Wshadow Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
albinhj
Posts: 6
Joined: Mon Jun 26, 2023 10:53 am
Been thanked: 3 times

Rename pow10 to allow gcc flag -Wshadow

Post by albinhj »

Hi,

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. (https://github.com/search?q=repo%3AChib ... &type=code)

Many thanks and best regards
Post Reply