Download raw body.
use size_t for loop indices to avoid signedness comparison warnings
use size_t for loop indices to avoid signedness comparison warnings
On Wed, Nov 25, 2020 at 10:55:49PM -0500, Ed Maste wrote:
> Found while attempting to build got as part of the FreeBSD base
> system, which enabled additional warnings.
Thank you! I have committed your patch.
Which compiler flags are you using on FreeBSD?
I have tried to reproduce the warnings you saw.
If I add -Wsign-compare I get additional warnings such as this one
on OpenBSD 6.8 with clang 10.0.1. Did you not see those or did you
limit your patch to cases involving size_t?
/home/stsp/src/got/libexec/got-read-blob/../../lib/error.c:140:23: error:
comparison of integers of different signs: 'int' and 'unsigned long'
[-Werror,-Wsign-compare]
if (ret == -1 || ret >= sizeof(msg))
~~~ ^ ~~~~~~~~~~~
/home/stsp/src/got/libexec/got-read-blob/../../lib/error.c:153:23: error:
comparison of integers of different signs: 'int' and 'unsigned long'
[-Werror,-Wsign-compare]
if (ret == -1 || ret >= sizeof(msg))
~~~ ^ ~~~~~~~~~~~
2 errors generated.
diff e99e2d157170987cd8665508a0adcbec58d040b6 /home/stsp/src/got
blob - 328c4a1e1795d88a1e53519b52ad67b9e682f85a
file + Makefile.inc
--- Makefile.inc
+++ Makefile.inc
@@ -10,7 +10,7 @@ BINDIR ?= ${PREFIX}/bin
LIBEXECDIR ?= ${PREFIX}/libexec
MANDIR ?= ${PREFIX}/man/man
.else
-CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
+CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable -Wsign-compare
PREFIX ?= ${HOME}
BINDIR ?= ${PREFIX}/bin
LIBEXECDIR ?= ${BINDIR}
use size_t for loop indices to avoid signedness comparison warnings
use size_t for loop indices to avoid signedness comparison warnings