Re: [PATCH 4/9] extrawarn: don't turn off -Wshift-negative-value for gcc-9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 12, 2023 at 5:00 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> The warning does nothing for newer versions of gcc since -fno-strict-overflow
> is used, on old versions it warns about lines that would be undefined
> otherwise:
>
> fs/isofs/util.c: In function 'iso_date':
> fs/isofs/util.c:40:14: error: left shift of negative value [-Werror=shift-negative-value]
>     tz |= (-1 << 8);
>               ^~
> drivers/video/fbdev/tdfxfb.c: In function 'tdfxfb_probe':
> drivers/video/fbdev/tdfxfb.c:1482:17: error: left shift of negative value [-Werror=shift-negative-value]
>       (PAGE_MASK << 1);
>                  ^~
> drivers/tty/serial/8250/8250_core.c: In function 'serial8250_request_rsa_resource':
> drivers/tty/serial/8250/8250_core.c:350:38: error: left shift of negative value [-Werror=shift-negative-value]
>   unsigned long start = UART_RSA_BASE << up->port.regshift;
>                                       ^~
> drivers/tty/serial/8250/8250_core.c: In function 'serial8250_release_rsa_resource':
> drivers/tty/serial/8250/8250_core.c:371:39: error: left shift of negative value [-Werror=shift-negative-value]
>   unsigned long offset = UART_RSA_BASE << up->port.regshift;
>                                        ^~
> drivers/clk/mvebu/dove-divider.c: In function 'dove_set_clock':
> drivers/clk/mvebu/dove-divider.c:145:14: error: left shift of negative value [-Werror=shift-negative-value]
>   mask = ~(~0 << dc->div_bit_size) << dc->div_bit_start;
>               ^~
> drivers/block/drbd/drbd_main.c: In function 'dcbp_set_pad_bits':
> drivers/block/drbd/drbd_main.c:1098:37: error: left shift of negative value [-Werror=shift-negative-value]
>   p->encoding = (p->encoding & (~0x7 << 4)) | (n << 4);
>
> Disable these conditionally to keep the command line a little shorter.



Just a nit for the commit subject and description.

It mentions only gcc, but also affects clang.




Is the following a better subject?

  extrawarn: don't turn off -Wshift-negative-value for gcc-9+ or clang

or

  extrawarn: turn off -Wshift-negative-value only for gcc < 9






-- 
Best Regards
Masahiro Yamada




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux