Hi,

I'm trying to reproduce this, but I don't seem to be able to get the same error 
as you.  I do get a warning with GCC about a cast to an anonymous struct, which 
the attached patch fixes, but even without this I'm able to build both with the 
gcc in 9 and the gcc in ports.  Can you let me know your gcc version?  
Unfortunately, the gcc error reporting isn't very helpful, so I don't know what 
it thinks it can't convert to a pointer type.  It would be great if you could 
try this patch, and if that doesn't fix it then try splitting the casts and 
dereferences into separate lines and see which part of this it is the gcc 
doesn't like.  

David

Index: include/block_abi.h
===================================================================
--- include/block_abi.h (revision 264042)
+++ include/block_abi.h (working copy)
@@ -50,14 +50,16 @@
        } *name
 #define CALL_BLOCK(name, ...) (name)->invoke(name, __VA_ARGS__)
 #endif // __BLOCKS__
+struct generic_block
+{
+       void *isa;
+       int flags;
+       int reserved;
+       void (*invoke)(void *, ...);
+};
 /**
  * Returns the pointer to the block-invoke function.  This is used for passing
  * blocks to functions that want a function pointer and a data pointer.
  */
 #define GET_BLOCK_FUNCTION(x) \
-       (((struct {\
-               void *isa;\
-               int flags;\
-               int reserved;\
-               void (*invoke)(void *, ...);\
-       }*)x)->invoke)
+       (((struct generic_block*)x)->invoke)


On 2 Apr 2014, at 20:15, Michael Butler <i...@protected-networks.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Seems that GCC doesn't like/understand the cast ..
> 
> imb@mail:/usr/src/lib/libc> sudo make
> cc  -O2 -pipe -march=pentium4  -I/usr/src/lib/libc/include
> - -I/usr/src/lib/libc/../../include -I/usr/src/lib/libc/i386 -DNLS
> - -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../contrib/gdtoa
> - -I/usr/src/lib/libc/../../contrib/libc-vis -DINET6
> - -I/usr/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE
> - -DPOSIX_MISTAKE -I/usr/src/lib/libc/../../contrib/jemalloc/include
> - -DMALLOC_PRODUCTION -I/usr/src/lib/libc/../../contrib/tzcode/stdtime
> - -I/usr/src/lib/libc/stdtime  -I/usr/src/lib/libc/locale -DBROKEN_DES
> - -DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING
> - -DSYMBOL_VERSIONING -std=gnu99  -fstack-protector -Wsystem-headers
> - -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c
> /usr/src/lib/libc/stdlib/atexit.c -o atexit.o
> /usr/src/lib/libc/stdlib/atexit.c: In function 'atexit_b':
> /usr/src/lib/libc/stdlib/atexit.c:157: error: cannot convert to a
> pointer type
> *** Error code 1
> 
> Stop.
> make: stopped in /usr/src/lib/libc
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> 
> iEYEARECAAYFAlM8YbcACgkQQv9rrgRC1JIucgCfRPm79qcKX9XpAfazKfGRsOry
> lOAAnRiHdpdRzLS5MtC7YPOsNeWZtiBS
> =2y7B
> -----END PGP SIGNATURE-----

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to