{"thread":{"id":"33643","subject":"[PATCH 5/6] compat/nedmalloc: Fix some sparse warnings","startedAt":"2013-04-27T18:45:02Z","lastAt":"2013-04-27T18:45:02Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"215727","messageId":"517C1CAE.8060006@ramsay1.demon.co.uk","threadId":"33643","inReplyTo":null,"subject":"[PATCH 5/6] compat/nedmalloc: Fix some sparse warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-04-27T18:45:02Z","receivedAt":"2013-04-27T18:45:02Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSparse issues many \"Using plain integer as NULL pointer\" warnings\nwhile checking nedmalloc.c (at least 98 such warnings before giving\nup due to \"too many warnings\"). In addition, sparse issues some\n\"non-ANSI function declaration\" type warnings for the symbols\n'win32_getcurrentthreadid', 'malloc_stats' and 'malloc_footprint'.\n\nIn order to suppress the NULL pointer warnings, rather than replace\nall uses of '0' as a null pointer representation with NULL, we add\n-Wno-non-pointer-null to SPARSE_FLAGS while checking nedmalloc.c.\n\nIn order to suppress the \"non-ANSI function declaration\" warnings,\nwe simply include the missing 'empty parameter list' prototype (void)\nin the function declarations.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n Makefile                     | 1 +\n compat/nedmalloc/malloc.c.h  | 2 +-\n compat/nedmalloc/nedmalloc.c | 4 ++--\n 3 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 0f931a2..450a1d4 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2004,6 +2004,7 @@ endif\n ifdef USE_NED_ALLOCATOR\n compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \\\n \t-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR\n+compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null\n endif\n \n git-%$X: %.o GIT-LDFLAGS $(GITLIBS)\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex 1401a67..fdcca82 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -1802,7 +1802,7 @@ struct win32_mlock_t\n \n static MLOCK_T malloc_global_mutex = { 0, 0, 0};\n \n-static FORCEINLINE long win32_getcurrentthreadid() {\n+static FORCEINLINE long win32_getcurrentthreadid(void) {\n #ifdef _MSC_VER\n #if defined(_M_IX86)\n   long *threadstruct=(long *)__readfsdword(0x18);\ndiff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c\nindex 91c4e7f..609ebba 100644\n--- a/compat/nedmalloc/nedmalloc.c\n+++ b/compat/nedmalloc/nedmalloc.c\n@@ -159,8 +159,8 @@ struct mallinfo nedmallinfo(void) THROWSPEC\t\t\t{ return nedpmallinfo(0); }\n #endif\n int    nedmallopt(int parno, int value) THROWSPEC\t{ return nedpmallopt(0, parno, value); }\n int    nedmalloc_trim(size_t pad) THROWSPEC\t\t\t{ return nedpmalloc_trim(0, pad); }\n-void   nedmalloc_stats() THROWSPEC\t\t\t\t\t{ nedpmalloc_stats(0); }\n-size_t nedmalloc_footprint() THROWSPEC\t\t\t\t{ return nedpmalloc_footprint(0); }\n+void   nedmalloc_stats(void) THROWSPEC\t\t\t\t\t{ nedpmalloc_stats(0); }\n+size_t nedmalloc_footprint(void) THROWSPEC\t\t\t\t{ return nedpmalloc_footprint(0); }\n void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC\t{ return nedpindependent_calloc(0, elemsno, elemsize, chunks); }\n void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC\t{ return nedpindependent_comalloc(0, elems, sizes, chunks); }\n \n-- \n1.8.2\n"}]}