Maxim Dounin
May 26, 2022 10:44PM
Hello!

On Thu, May 26, 2022 at 02:42:14PM -0700, Andres Beltran wrote:

> Gently ping on this patch. Any comments?
>
> On 3/14/2022 4:42 PM, Sinan Kaya wrote:
>
> > # HG changeset patch
> > # User Sinan Kaya <sinan.kaya@microsoft.com>
> > # Date 1647289518 14400
> > #      Mon Mar 14 16:25:18 2022 -0400
> > # Node ID f22520b612969dbfa17205129510927519370000
> > # Parent  a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
> > fix -Wsign-conversion warning with gcc 8.2
> >
> > Getting compiler warning with -Wsign-conversion.
> >
> > /usr/include/nginx/core/ngx_crc32.h:31:47: warning: conversion to
> > 'uint32_t' {aka 'unsigned int'} from 'int' may change the sign of the
> > result [-Wsign-conversion]
> >    31 |         crc = ngx_crc32_table_short[(crc ^ (c >> 4)) & 0xf] ^
> > (crc >> 4);
> >
> > diff -r a736a7a613ea -r f22520b61296 src/core/ngx_crc32.h
> > --- a/src/core/ngx_crc32.h    Tue Feb 08 17:35:27 2022 +0300
> > +++ b/src/core/ngx_crc32.h    Mon Mar 14 16:25:18 2022 -0400
> > @@ -28,7 +28,8 @@
> >      while (len--) {
> >          c = *p++;
> >          crc = ngx_crc32_table_short[(crc ^ (c & 0xf)) & 0xf] ^ (crc >>
> > 4);
> > -        crc = ngx_crc32_table_short[(crc ^ (c >> 4)) & 0xf] ^ (crc
> >> 4);
> > +        crc = ngx_crc32_table_short[(crc ^ (u_char)(c >> 4)) & 0xf];
> > +        crc = crc ^ (crc >> 4);
> >      }
> >
> >      return crc ^ 0xffffffff;

Trying to compile nginx with -Wsign-conversion produces a lot more
than this specific (mis)warning. For more or less obvious reasons
there are no plans to silence them: this is going to be a large
work which is highly unlikely to catch any real bugs, yet will
result in a lot of garbage in the code.

If for some reason you think this particular warning should be
silenced, you may want to elaborate more on your reasons.

Hope this helps.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[PATCH] fix -Wsign-conversion warning with gcc 8.2

Sinan Kaya 796 March 14, 2022 04:44PM

Re: [PATCH] fix -Wsign-conversion warning with gcc 8.2

Andres Beltran 112 May 26, 2022 05:44PM

Re: [PATCH] fix -Wsign-conversion warning with gcc 8.2

Maxim Dounin 103 May 26, 2022 10:44PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 260
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready