]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat/nedmalloc: Fix some sparse warnings
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>
Sat, 27 Apr 2013 18:45:02 +0000 (19:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Apr 2013 19:24:48 +0000 (12:24 -0700)
Sparse issues many "Using plain integer as NULL pointer" warnings
while checking nedmalloc.c (at least 98 such warnings before giving
up due to "too many warnings"). In addition, sparse issues some
"non-ANSI function declaration" type warnings for the symbols
'win32_getcurrentthreadid', 'malloc_stats' and 'malloc_footprint'.

In order to suppress the NULL pointer warnings, rather than replace
all uses of '0' as a null pointer representation with NULL, we add
-Wno-non-pointer-null to SPARSE_FLAGS while checking nedmalloc.c.

In order to suppress the "non-ANSI function declaration" warnings,
we simply include the missing 'empty parameter list' prototype (void)
in the function declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
compat/nedmalloc/malloc.c.h
compat/nedmalloc/nedmalloc.c

index 0f931a203002aec397f8b454f93df9aee97a21ad..450a1d44834525bf77b6e39c481ec81e59c04d35 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2004,6 +2004,7 @@ endif
 ifdef USE_NED_ALLOCATOR
 compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
        -DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
+compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
 endif
 
 git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
index 1401a6727414480e181023f8de974bad76a04d24..fdcca82ba7d19f0072938e524d254d91d2b560b3 100644 (file)
@@ -1802,7 +1802,7 @@ struct win32_mlock_t
 
 static MLOCK_T malloc_global_mutex = { 0, 0, 0};
 
-static FORCEINLINE long win32_getcurrentthreadid() {
+static FORCEINLINE long win32_getcurrentthreadid(void) {
 #ifdef _MSC_VER
 #if defined(_M_IX86)
   long *threadstruct=(long *)__readfsdword(0x18);
index 91c4e7f27b4063c7ceffeeb1cd43530ce18cf096..609ebba1258eac47983f2b9da5d582a5d5af5482 100644 (file)
@@ -159,8 +159,8 @@ struct mallinfo nedmallinfo(void) THROWSPEC                 { return nedpmallinfo(0); }
 #endif
 int    nedmallopt(int parno, int value) THROWSPEC      { return nedpmallopt(0, parno, value); }
 int    nedmalloc_trim(size_t pad) THROWSPEC                    { return nedpmalloc_trim(0, pad); }
-void   nedmalloc_stats() THROWSPEC                                     { nedpmalloc_stats(0); }
-size_t nedmalloc_footprint() THROWSPEC                         { return nedpmalloc_footprint(0); }
+void   nedmalloc_stats(void) THROWSPEC                                 { nedpmalloc_stats(0); }
+size_t nedmalloc_footprint(void) THROWSPEC                             { return nedpmalloc_footprint(0); }
 void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC { return nedpindependent_calloc(0, elemsno, elemsize, chunks); }
 void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC   { return nedpindependent_comalloc(0, elems, sizes, chunks); }