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
Jarkko Hietaniemi
April 28, 2014 00:14
Re: FYI: sv.c warnings from blead on OS X 10.9
Message ID:
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); })
#define UNUSED_RESULT(v) ((void)(v))

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

[1] vagrant in OS X rocks.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About