[libvirt] [PATCH] build: avoid gcc 4.7 warning about inlines

gcc 4.7 complains: util/virhashcode.c:49:17: error: always_inline function might not be inlinable [-Werror=attributes] util/virhashcode.c:35:17: error: always_inline function might not be inlinable [-Werror=attributes] Normal 'inline' is a hint that the compiler may ignore; the fact that the function is static is good enough. We don't care if the compiler decided not to inline after all. * src/util/virhashcode.c (getblock, fmix): Relax attribute. --- Pushing under the build-breaker rule; this lets the build get further on rawhide (it later fails with: GEN remote/remote_protocol.h /usr/bin/rpcgen: C preprocessor failed with exit code 1 cannot shutdown /usr/bin/rpcgen: at ./rpc/genprotocol.pl line 122. that I still have to investigate). src/util/virhashcode.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/virhashcode.c b/src/util/virhashcode.c index 6d91793..d16d544 100644 --- a/src/util/virhashcode.c +++ b/src/util/virhashcode.c @@ -31,8 +31,7 @@ #include "bitrotate.h" /* slower than original but handles platforms that do only aligned reads */ -__attribute__((always_inline)) -static uint32_t getblock(const uint8_t *p, int i) +static inline uint32_t getblock(const uint8_t *p, int i) { uint32_t r; size_t size = sizeof(r); @@ -45,8 +44,7 @@ static uint32_t getblock(const uint8_t *p, int i) /* * Finalization mix - force all bits of a hash block to avalanche */ -__attribute__((always_inline)) -static uint32_t fmix(uint32_t h) +static inline uint32_t fmix(uint32_t h) { h ^= h >> 16; h *= 0x85ebca6b; -- 1.7.7.6

On 02/06/2012 08:12 PM, Eric Blake wrote:
gcc 4.7 complains:
util/virhashcode.c:49:17: error: always_inline function might not be inlinable [-Werror=attributes] util/virhashcode.c:35:17: error: always_inline function might not be inlinable [-Werror=attributes]
Normal 'inline' is a hint that the compiler may ignore; the fact that the function is static is good enough. We don't care if the compiler decided not to inline after all.
* src/util/virhashcode.c (getblock, fmix): Relax attribute. ---
Pushing under the build-breaker rule; this lets the build get further on rawhide (it later fails with: GEN remote/remote_protocol.h /usr/bin/rpcgen: C preprocessor failed with exit code 1 cannot shutdown /usr/bin/rpcgen: at ./rpc/genprotocol.pl line 122. that I still have to investigate).
It turns out that this later failure appears to have been due to a bug in gcc; upgrading to the latest rawhide pulled in a new gcc build where rpcgen no longer fails do to a preprocessor failure, but the generated file no longer compiles. I'm still investigating. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 02/07/2012 03:57 PM, Eric Blake wrote:
On 02/06/2012 08:12 PM, Eric Blake wrote:
gcc 4.7 complains:
util/virhashcode.c:49:17: error: always_inline function might not be inlinable [-Werror=attributes] util/virhashcode.c:35:17: error: always_inline function might not be inlinable [-Werror=attributes]
Normal 'inline' is a hint that the compiler may ignore; the fact that the function is static is good enough. We don't care if the compiler decided not to inline after all.
* src/util/virhashcode.c (getblock, fmix): Relax attribute. ---
Pushing under the build-breaker rule; this lets the build get further on rawhide (it later fails with: GEN remote/remote_protocol.h /usr/bin/rpcgen: C preprocessor failed with exit code 1 cannot shutdown /usr/bin/rpcgen: at ./rpc/genprotocol.pl line 122. that I still have to investigate).
It turns out that this later failure appears to have been due to a bug in gcc; upgrading to the latest rawhide pulled in a new gcc build where rpcgen no longer fails do to a preprocessor failure, but the generated file no longer compiles. I'm still investigating.
That in turn was due to stale contents from the broken gcc version. A 'make clean' cleared up the broken src/remote/remote_protocol.h (it had a literal 'cannot find any C preprocessor' comment leaked from rpcgen when run against the earlier gcc), at which point a fresh rpcgen rerun fixed things, and I'm successfully building on rawhide again. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (1)
-
Eric Blake