r3611 - branches/2.0/varnish-cache/lib/libjemalloc

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Feb 5 12:23:44 CET 2009


Author: tfheen
Date: 2009-02-05 12:23:44 +0100 (Thu, 05 Feb 2009)
New Revision: 3611

Modified:
   branches/2.0/varnish-cache/lib/libjemalloc/jemalloc_linux.c
Log:
Merge r3399+3430: Fixed compiling on Linux with -Werror set.

Fixed compiling on Linux with -Werror set. Added mising prototypes, removed an unused function and added the ATTRIBUTE_UNUSED to the attribute list for the rb_wrap() macro which generated unused functions.

r3430 | tfheen | 2008-11-24 20:08:36 +0100 (ma., 24 nov. 2008) | 4 lines

Include relevant bit of ansidecl.h directly

Avoids build-dependency on binutils-dev



Modified: branches/2.0/varnish-cache/lib/libjemalloc/jemalloc_linux.c
===================================================================
--- branches/2.0/varnish-cache/lib/libjemalloc/jemalloc_linux.c	2009-02-05 11:17:44 UTC (rev 3610)
+++ branches/2.0/varnish-cache/lib/libjemalloc/jemalloc_linux.c	2009-02-05 11:23:44 UTC (rev 3611)
@@ -200,6 +200,17 @@
 
 #include "rb.h"
 
+/* Prevent -Werror to complain about unused parameters when compiling
+   with non-ancient GCC.  Added directly here instead of grabbed from
+   ansidecl.h to save a build dependency on binutils-dev */
+#if __GNUC__ >= 3
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
 #ifdef MALLOC_DEBUG
    /* Disable inlining to make debugging easier. */
 #  define inline
@@ -1113,7 +1124,6 @@
 static bool	base_pages_alloc_mmap(size_t minsize);
 static bool	base_pages_alloc(size_t minsize);
 static void	*base_alloc(size_t size);
-static void	*base_calloc(size_t number, size_t size);
 static extent_node_t *base_node_alloc(void);
 static void	base_node_dealloc(extent_node_t *node);
 #ifdef MALLOC_STATS
@@ -1200,6 +1210,14 @@
  */
 /******************************************************************************/
 
+/*
+ * Functions missing prototypes which caused -Werror to fail. 
+ * Not sure if it has any side effects.
+ * */
+size_t malloc_usable_size(const void *ptr);
+void _malloc_thread_cleanup(void);
+
+
 static void
 wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4)
 {
@@ -1625,17 +1643,6 @@
 	return (ret);
 }
 
-static void *
-base_calloc(size_t number, size_t size)
-{
-	void *ret;
-
-	ret = base_alloc(number * size);
-	memset(ret, 0, number * size);
-
-	return (ret);
-}
-
 static extent_node_t *
 base_node_alloc(void)
 {
@@ -1779,7 +1786,7 @@
 }
 
 /* Wrap red-black tree macros in functions. */
-rb_wrap(static, extent_tree_szad_, extent_tree_t, extent_node_t,
+rb_wrap(static ATTRIBUTE_UNUSED, extent_tree_szad_, extent_tree_t, extent_node_t,
     link_szad, extent_szad_comp)
 #endif
 
@@ -1793,7 +1800,7 @@
 }
 
 /* Wrap red-black tree macros in functions. */
-rb_wrap(static, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad,
+rb_wrap(static ATTRIBUTE_UNUSED, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad,
     extent_ad_comp)
 
 /*
@@ -2347,7 +2354,7 @@
 }
 
 /* Wrap red-black tree macros in functions. */
-rb_wrap(static, arena_chunk_tree_dirty_, arena_chunk_tree_t,
+rb_wrap(static ATTRIBUTE_UNUSED, arena_chunk_tree_dirty_, arena_chunk_tree_t,
     arena_chunk_t, link_dirty, arena_chunk_comp)
 
 static inline int
@@ -2363,7 +2370,7 @@
 }
 
 /* Wrap red-black tree macros in functions. */
-rb_wrap(static, arena_run_tree_, arena_run_tree_t, arena_chunk_map_t,
+rb_wrap(static ATTRIBUTE_UNUSED, arena_run_tree_, arena_run_tree_t, arena_chunk_map_t,
     link, arena_run_comp)
 
 static inline int
@@ -2395,7 +2402,7 @@
 }
 
 /* Wrap red-black tree macros in functions. */
-rb_wrap(static, arena_avail_tree_, arena_avail_tree_t,
+rb_wrap(static ATTRIBUTE_UNUSED, arena_avail_tree_, arena_avail_tree_t,
     arena_chunk_map_t, link, arena_avail_comp)
 
 static inline void *



More information about the varnish-commit mailing list