Re: [PATCH] blk-iocost: don't make all constants unsigned long long
From: Tejun Heo
Date: Wed Jan 04 2023 - 17:16:24 EST
On Tue, Dec 20, 2022 at 09:18:19PM +0100, Yann Droneaud wrote:
> My shiny new compiler (GCC 13) is reporting the following
> warnings:
>
> ../block/blk-iocost.c: In function 'ioc_weight_prfill':
> ../block/blk-iocost.c:3035:37: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
> 3035 | seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE);
> | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | | |
> | unsigned int long unsigned int
> | %lu
> ../block/blk-iocost.c: In function 'ioc_weight_show':
> ../block/blk-iocost.c:3045:34: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
> 3045 | seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ONE);
> | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | | |
> | unsigned int long unsigned int
> | %lu
>
> It appears WEIGHT_ONE enum is unnecessarly unsigned long
> (or unsigned long long on 32bit) because of VTIME_PER_SEC
> and/or AUTOP_CYCLE_NSEC need the enum to be that large.
>
> Addressed by lazy splitting the "catch all" anonymous
> enum and placing the unsigned long long constants in
> their own anonymous enums.
>
> Signed-off-by: Yann Droneaud <ydroneaud@xxxxxxxxxx>
There's a better patch doing this which groups the enums into two groups.
Let's do that instead.
Thanks.
--
tejun