Bug 1368932 - Don't rely on the default MALLOC_DECL_VOID for malloc function declarations in replace-malloc. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 25 May 2017 15:58:56 +0900
changeset 586886 74f38b4f44d698664b0129d0cf2bee63e9aefa93
parent 586885 6e10c132f8298ccd44b72ca9498880c4f6b923ad
child 586887 475e999c64657de22ce81d316a16044e5e4ad60e
push id61568
push userbmo:mh+mozilla@glandium.org
push dateWed, 31 May 2017 08:30:17 +0000
reviewersnjn
bugs1368932
milestone55.0a1
Bug 1368932 - Don't rely on the default MALLOC_DECL_VOID for malloc function declarations in replace-malloc. r?njn In practice, this induces no change in what the expanded code looks like.
memory/build/replace_malloc.c
--- a/memory/build/replace_malloc.c
+++ b/memory/build/replace_malloc.c
@@ -101,24 +101,31 @@ replace_malloc_init_funcs()
  */
 
 /*
  * Malloc implementation functions are MOZ_MEMORY_API, and jemalloc
  * specific functions MOZ_JEMALLOC_API; see mozmemory_wrap.h
  */
 #define MACRO_CALL(a, b) a b
 
-#define GENERIC_MALLOC_DECL(name, return_type, ...) \
+#define GENERIC_MALLOC_DECL_HELPER(name, return_type, ...) \
   return_type name ## _impl(__VA_ARGS__);
 
+#define GENERIC_MALLOC_DECL(name, return_type, ...) \
+  GENERIC_MALLOC_DECL_HELPER(name, return_type, ##__VA_ARGS__)
+#define GENERIC_MALLOC_DECL_VOID(name, ...) \
+  GENERIC_MALLOC_DECL_HELPER(name, void, ##__VA_ARGS__)
+
 #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__))
+#define MALLOC_DECL_VOID(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL_VOID, (__VA_ARGS__))
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC
 #include "malloc_decls.h"
 
 #define MALLOC_DECL(...) MOZ_JEMALLOC_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__))
+#define MALLOC_DECL_VOID(...) MOZ_JEMALLOC_API MACRO_CALL(GENERIC_MALLOC_DECL_VOID, (__VA_ARGS__))
 #define MALLOC_FUNCS MALLOC_FUNCS_JEMALLOC
 #include "malloc_decls.h"
 
 static int replace_malloc_initialized = 0;
 static void
 init()
 {
 #ifdef MOZ_NO_REPLACE_FUNC_DECL