This is the mail archive of the
mailing list for the GCC project.
Re: question regarding new warning
- From: Florian Weimer <fweimer at redhat dot com>
- To: Andrew Haley <aph at redhat dot com>, Daniel Gutson <daniel dot gutson at tallertechnologies dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 27 Mar 2014 09:52:29 +0100
- Subject: Re: question regarding new warning
- Authentication-results: sourceware.org; auth=none
- References: <CAF5HaEV2vt=epA4h-rPGDNnXtUFWXhJeqyAF0k06b1Wuoec97g at mail dot gmail dot com> <5333D6F5 dot 5080008 at redhat dot com>
On 03/27/2014 08:44 AM, Andrew Haley wrote:
On 03/26/2014 03:05 PM, Daniel Gutson wrote:
assigning a negative literal to an unsigned variable issues no warning:
unsigned int x;
x =- 4;
This is specially important in typos when -= was intended instead of =-
Would be acceptable if I add a new warning to handle this, i.e.
Assigning a negative literal to an unsigned variable is well-defined
standard C. Is it really appropriate to warn for correct code?
Yes, this warning needs to take whitespace into account. But then, I
suppose it would be fine.
Florian Weimer / Red Hat Product Security Team