[ccan] rbtree.c build failure with gcc 4.5.1

Joseph Adams joeyadams3.14159 at gmail.com
Wed Dec 15 16:51:11 EST 2010


On Sat, Nov 13, 2010 at 5:50 PM, Scott Olson <scotto701 at gmail.com> wrote:
> Hi,
>
> I am getting the following warning/error build failure on fedora 14
> with gcc-4.5.1
>
> cc1: warnings being treated as errors
> ccan/rbtree/rbtree.c: In function ‘tree_destructor_traverse_node’:
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> ccan/rbtree/rbtree.c:24:2: error: taking address of expression of type ‘void’
> make: *** [ccan/rbtree/rbtree.o] Error 1
>
> This doesn't happen on fedora 12 with gcc-4.4.4. I'm not much of a C
> programmer so I have no idea how to fix it. I only wanted to mess with
> the dns_lookup example program in antithread
>
> -scott
> _______________________________________________
> ccan mailing list
> ccan at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/ccan
>

Looks like an issue in the typesafe_cb_def macro.  I'm not familiar
with the typesafe macros, but it looks like the newer version of GCC
is griping about constructions like:

   &*NULL

When I compile the following with gcc 4.4.3:

       #include <stdio.h>

       int main(void)
       {
               printf("NULL: %p\n", &*NULL);
               return 0;
       }

I merely get a warning:

       null.c: In function ‘main’:
       null.c:5: warning: dereferencing ‘void *’ pointer

I don't have gcc 4.5 handy, but I hypothesize that the above code
won't compile with it.  I'm downloading Fedora 14 now.

The following momentary workaround should tide you over until this gets fixed:

diff --git a/ccan/rbtree/rbtree.c b/ccan/rbtree/rbtree.c
index 753935b..775014c 100644
--- a/ccan/rbtree/rbtree.c
+++ b/ccan/rbtree/rbtree.c
@@ -21,7 +21,7 @@
 static void
 tree_destructor_traverse_node(TALLOC_CTX *mem_ctx, trbt_node_t *node)
 {
-       talloc_set_destructor(node, NULL);
+       _talloc_set_destructor(node, NULL);
       if (node->left) {
               tree_destructor_traverse_node(mem_ctx, node->left);
       }


Cheers,


Joey Adams

P.S.:  Oops, forgot to copy the list.


More information about the ccan mailing list