]> arthur.barton.de Git - bup.git/commitdiff
checked_malloc: use %z to format size_t; enable -Wformat=2
authorRob Browning <rlb@defaultvalue.org>
Sun, 9 Aug 2020 18:07:01 +0000 (13:07 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 9 Aug 2020 18:07:05 +0000 (13:07 -0500)
Reported-by: Greg Troxel <gdt@lexort.com>
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Makefile
lib/bup/_helpers.c

index d96c149cb958b5dff7b8195212968216bac81002..e4bc7d655b5285ab5207b2367daef4f92b528040 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,8 +28,8 @@ current_sampledata := t/sampledata/var/rev/v$(sampledata_rev)
 os := $(shell ($(pf); uname | sed 's/[-_].*//') $(isok))
 os := $(call shout,$(os),Unable to determine OS)
 
-CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
-CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
+CFLAGS := -Wall -Werror=format=2 -O2 -Werror -Wno-unknown-pragmas $(CFLAGS)
+CFLAGS := -D_FILE_OFFSET_BITS=64 $(PYINCLUDE) $(CFLAGS)
 SOEXT:=.so
 
 ifeq ($(os),CYGWIN)
index 489bd14768884ad346693266b80792f7aa53151f..a6ffd322e1ea73bdafaaa9f34c0dc7e948931518 100644 (file)
@@ -129,7 +129,7 @@ static void *checked_malloc(size_t n, size_t size)
     if (__builtin_mul_overflow(n, size, &total))
     {
         PyErr_Format(PyExc_OverflowError,
-                     "request to allocate %lu items of size %lu is too large",
+                     "request to allocate %zu items of size %zu is too large",
                      n, size);
         return NULL;
     }