Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Apr 2014 20:30:45 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Michael Butler <imb@protected-networks.net>
Cc:        FreeBSD Current <freebsd-current@FreeBSD.org>
Subject:   Re: gcc compilation broken with SVN r264042
Message-ID:  <509CAA08-8F00-4ED8-81FF-A51F1ECDC15C@FreeBSD.org>
In-Reply-To: <533C61B8.7060809@protected-networks.net>
References:  <533C61B8.7060809@protected-networks.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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. =20=


David

Index: include/block_abi.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 <imb@protected-networks.net> =
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>=20
> Seems that GCC doesn't like/understand the cast ..
>=20
> imb@mail:/usr/src/lib/libc> sudo make
> cc  -O2 -pipe -march=3Dpentium4  -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=3Dgnu99  -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
>=20
> Stop.
> make: stopped in /usr/src/lib/libc
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>=20
> iEYEARECAAYFAlM8YbcACgkQQv9rrgRC1JIucgCfRPm79qcKX9XpAfazKfGRsOry
> lOAAnRiHdpdRzLS5MtC7YPOsNeWZtiBS
> =3D2y7B
> -----END PGP SIGNATURE-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?509CAA08-8F00-4ED8-81FF-A51F1ECDC15C>