Skip to content

Commit 241c957

Browse files
Ramsay Jonesgitster
authored andcommitted
compat/nedmalloc: Fix some sparse warnings
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4fc8fb4 commit 241c957

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,7 @@ endif
20042004
ifdef USE_NED_ALLOCATOR
20052005
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
20062006
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
2007+
compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
20072008
endif
20082009

20092010
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)

compat/nedmalloc/malloc.c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ struct win32_mlock_t
18021802

18031803
static MLOCK_T malloc_global_mutex = { 0, 0, 0};
18041804

1805-
static FORCEINLINE long win32_getcurrentthreadid() {
1805+
static FORCEINLINE long win32_getcurrentthreadid(void) {
18061806
#ifdef _MSC_VER
18071807
#if defined(_M_IX86)
18081808
long *threadstruct=(long *)__readfsdword(0x18);

compat/nedmalloc/nedmalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ struct mallinfo nedmallinfo(void) THROWSPEC { return nedpmallinfo(0); }
159159
#endif
160160
int nedmallopt(int parno, int value) THROWSPEC { return nedpmallopt(0, parno, value); }
161161
int nedmalloc_trim(size_t pad) THROWSPEC { return nedpmalloc_trim(0, pad); }
162-
void nedmalloc_stats() THROWSPEC { nedpmalloc_stats(0); }
163-
size_t nedmalloc_footprint() THROWSPEC { return nedpmalloc_footprint(0); }
162+
void nedmalloc_stats(void) THROWSPEC { nedpmalloc_stats(0); }
163+
size_t nedmalloc_footprint(void) THROWSPEC { return nedpmalloc_footprint(0); }
164164
void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC { return nedpindependent_calloc(0, elemsno, elemsize, chunks); }
165165
void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC { return nedpindependent_comalloc(0, elems, sizes, chunks); }
166166

0 commit comments

Comments
 (0)