lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] compilation problem in round_to_test.cpp


From: Greg Chicares
Subject: Re: [lmi] compilation problem in round_to_test.cpp
Date: Mon, 02 Jun 2008 15:52:36 +0000
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

On 2008-06-01 23:25Z, Vadim Zeitlin wrote:
[snip patch]
> (although it's not totally clear from the diff, this patch simply changes
> the order of __STDC_IEC_559__ and LMI_X86 checks).

Does the alternative patch below fix the problem?

Here's why I propose an alternative. Elsewhere in lmi, C99 macro
__STDC_IEC_559__ is tested first, and platform is tested later if
necessary; the intention is:
  where we've got a complete C99 implementation, just use it;
  otherwise, fall back on platform-specific code.
I like to think that someday C++ will incorporate the applicable
parts of C99, which will be fully supported by all reasonable
C++ compilers. On that happy day, I think we'll congratulate
ourselves on our foresight. But let me know if you think that's
not the best vision for the future.

However, I didn't follow that intention in 'fenv_lmi.hpp', so I
think that's the best place to fix it--provided that this patch
works, or can reasonably be made to work. I don't have a compiler
that defines __STDC_IEC_559__, but this patch doesn't break any
unit tests with MinGW gcc or como-upon-MinGW.

Index: fenv_lmi.hpp
===================================================================
RCS file: /sources/lmi/lmi/fenv_lmi.hpp,v
retrieving revision 1.16
diff -u -r1.16 fenv_lmi.hpp
--- fenv_lmi.hpp        1 Jan 2008 18:29:40 -0000       1.16
+++ fenv_lmi.hpp        2 Jun 2008 15:16:26 -0000
@@ -28,12 +28,6 @@

 #include "so_attributes.hpp"

-#if defined LMI_X86
-#   include "fenv_lmi_x86.hpp"
-#else  // Unknown compiler or platform.
-#   error Unknown compiler or platform.
-#endif // Unknown compiler or platform.
-
 #if defined __STDC_IEC_559__ || defined __MINGW32__
 // In case the C++ compiler supports C99 7.6 facilities, assume that
 // it defines __STDC_IEC_559__ (except that MinGW supports some such
@@ -48,6 +42,17 @@
 #   else  // Pragma STDC FENV_ACCESS implemented.
 #       pragma STDC FENV_ACCESS ON
 #   endif // Pragma STDC FENV_ACCESS implemented.
+#   if defined __MINGW32__
+// This toolchain doesn't define __STDC_IEC_559__, yet has significant
+// C99 support.
+#       include "fenv_lmi_x86.hpp"
+#   endif // defined __MINGW32__
+#else // !defined __STDC_IEC_559__
+#   if defined LMI_X86
+#       include "fenv_lmi_x86.hpp"
+#   else  // Unknown compiler or platform.
+#       error Unknown compiler or platform.
+#   endif // Unknown compiler or platform.
 #endif // defined __STDC_IEC_559__ || defined __MINGW32__

 /// These functions manage the floating-point environment.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]