This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: -Wmemsize-comparison warning on clang
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Jack Howarth <howarth dot mailing dot lists at gmail dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Sat, 28 Feb 2015 08:28:53 +0100
- Subject: Re: -Wmemsize-comparison warning on clang
- Authentication-results: sourceware.org; auth=none
- References: <CADtEn-16vTyZrNNC9WXZcynjUa6PLULpCTh+1E5vPeqyjYwqwg at mail dot gmail dot com>
On Fri, Feb 27, 2015 at 01:41:29PM -0500, Jack Howarth wrote:
> The gdb-7.9 release produces a warning on clang for -Wmemsize-comparison of...
>
> remote.c:5519:47: warning: size argument in 'strncmp' call is a
> comparison [-Wmemsize-comparison]
> && strncmp (p, "core", strlen ("core") != 0))
> ~~~~~~~~~~~~~~~~^~~~
> remote.c:5519:11: note: did you mean to compare the result of 'strncmp' instead?
> && strncmp (p, "core", strlen ("core") != 0))
> ^ ~
> )
> remote.c:5519:31: note: explicitly cast the argument to size_t to
> silence this warning
> && strncmp (p, "core", strlen ("core") != 0))
> ^
> (size_t)( )
Those look like bona fide bugs in GDB's code!
--
Joel