develooper Front page | perl.perl5.changes | Postings from April 2008

Change 33762: Cast the result of fpsetmask(0) to (void), as some implementations

From:
Nicholas Clark
Date:
April 28, 2008 13:45
Subject:
Change 33762: Cast the result of fpsetmask(0) to (void), as some implementations
Change 33762 by nicholas@nicholas-plum on 2008/04/28 20:41:31

	Cast the result of fpsetmask(0) to (void), as some implementations
	expand it via a macro, with a comma expression to calculate the return
	value, at which point gcc has the gall to warn that an expression
	calcualted is not used.
	Blame SCO for having to have fpsetmask(0) in the code to start with.

Affected files ...

... //depot/perl/perl.h#837 edit

Differences ...

==== //depot/perl/perl.h#837 (text) ====
Index: perl/perl.h
--- perl/perl.h#836~33629~	2008-04-02 11:23:58.000000000 -0700
+++ perl/perl.h	2008-04-28 13:41:31.000000000 -0700
@@ -2651,7 +2651,11 @@
 #    if HAS_FLOATINGPOINT_H
 #      include <floatingpoint.h>
 #    endif
-#    define PERL_FPU_INIT fpsetmask(0)
+/* Some operating systems have this as a macro, which in turn expands to a comma
+   expression, and the last sub-expression is something that gets calculated,
+   and then they have the gall to warn that a value computed is not used. Hence
+   cast to void.  */
+#    define PERL_FPU_INIT (void)fpsetmask(0)
 #  else
 #    if defined(SIGFPE) && defined(SIG_IGN) && !defined(PERL_MICRO)
 #      define PERL_FPU_INIT       PL_sigfpe_saved = (Sighandler_t) signal(SIGFPE, SIG_IGN)
End of Patch.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About