develooper Front page | perl.perl5.porters | Postings from April 2014

Re: FYI: sv.c warnings from blead on OS X 10.9

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
April 28, 2014 00:14
Subject:
Re: FYI: sv.c warnings from blead on OS X 10.9
Message ID:
535D9D46.9060602@iki.fi
On Sunday-201404-27, 18:37, Karl Williamson wrote:
> The makers of gcc refuse to consider casting to (void) to be a valid way
> of handling the return value of a function which is declared as having
> its return value not ignored.

Had to see this myself... I started up a Linux image [1] and now I see 
somewhat more clearly... oh, so, yes it's not so much a gcc issue alone, 
though, but an interaction of gcvt() being marked up with the gcc 
attribute warn_unused_result (in glibc, I guess).  And (void) in gcc 
failing to overcome that attribute.

Maybe something like:

#ifdef __GNUC__
#define UNUSED_RESULT(v) ({ typeof(v) z = (v); (void)sizeof(z); })
#else
#define UNUSED_RESULT(v) ((void)(v))
#endif

Or something.  No idea how typeof fares across GCC versions (that 
solution nicked from stackoverflow, we are not the first to have this 
problem).

[1] vagrant in OS X rocks.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About