Mercurial > hg > octave-lyh
changeset 8856:ab4db66e286f
workaround gcc 4.3 explicit instantiation bug in octave_int_cmp_op
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 24 Feb 2009 11:15:05 +0100 |
parents | a909d8c01adf |
children | 20589a8f1a33 |
files | liboctave/ChangeLog liboctave/oct-inttypes.cc liboctave/oct-inttypes.h |
diffstat | 3 files changed, 35 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,14 @@ +2009-02-23 Jaroslav Hajek <highegg@gmail.com> + + * oct-inttypes.h (octave_int_cmp_op::mop): Implement as simple + forwarders when OCTAVE_INT_USE_LONG_DOUBLE is not defined. + (octave_int_cmp_op::emulate_mop): New static overloaded template + member function. + * oct-inttypes.cc: Turn the octave_int_cmp_op::mop definitions into + defs for octave_int_cmp_op::emulate_mop. + (INSTANTIATE_INT64_DOUBLE_CMP_OP0): Instantiate + octave_int_cmp_op::emulate_op instead. + 2009-02-23 Jaroslav Hajek <highegg@gmail.com> * dDiagMatrix.cc (DiagMatrix::pseudo_inverse): New method.
--- a/liboctave/oct-inttypes.cc +++ b/liboctave/oct-inttypes.cc @@ -56,7 +56,7 @@ template <class xop> OCTAVE_API bool -octave_int_cmp_op::mop (uint64_t x, double y) +octave_int_cmp_op::emulate_mop (uint64_t x, double y) { static const double xxup = std::numeric_limits<uint64_t>::max (); // This converts to the nearest double. Unless there's an equality, the @@ -76,7 +76,7 @@ template <class xop> OCTAVE_API bool -octave_int_cmp_op::mop (int64_t x, double y) +octave_int_cmp_op::emulate_mop (int64_t x, double y) { static const double xxup = std::numeric_limits<int64_t>::max (); static const double xxlo = std::numeric_limits<int64_t>::min (); @@ -123,7 +123,7 @@ template <class xop> OCTAVE_API bool -octave_int_cmp_op::mop (double x, uint64_t y) +octave_int_cmp_op::emulate_mop (double x, uint64_t y) { typedef typename rev_op<xop>::op rop; return mop<rop> (y, x); @@ -131,7 +131,7 @@ template <class xop> OCTAVE_API bool -octave_int_cmp_op::mop (double x, int64_t y) +octave_int_cmp_op::emulate_mop (double x, int64_t y) { typedef typename rev_op<xop>::op rop; return mop<rop> (y, x); @@ -499,8 +499,8 @@ } #define INSTANTIATE_INT64_DOUBLE_CMP_OP0(OP,T1,T2) \ - template OCTAVE_API bool \ - octave_int_cmp_op::mop<octave_int_cmp_op::OP> (T1 x, T2 y) + template bool \ + octave_int_cmp_op::emulate_mop<octave_int_cmp_op::OP> (T1 x, T2 y) #define INSTANTIATE_INT64_DOUBLE_CMP_OP(OP) \ INSTANTIATE_INT64_DOUBLE_CMP_OP0(OP, double, int64_t); \
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -192,20 +192,29 @@ return xop::op (static_cast<long double> (x), \ static_cast<long double> (y)); \ } +#else + // ... otherwise, use external handlers + + // FIXME: We could declare directly the mop methods as external, + // but we can't do this because bugs in gcc (<= 4.3) prevent + // explicit instantiations later in that case. +#define DEFINE_LONG_DOUBLE_CMP_OP(T1, T2) \ + template <class xop> static OCTAVE_API bool \ + emulate_mop (T1, T2); \ + template <class xop> \ + static bool \ + mop (T1 x, T2 y) \ + { \ + return emulate_mop<xop> (x, y); \ + } +#endif + DEFINE_LONG_DOUBLE_CMP_OP(double, uint64_t) DEFINE_LONG_DOUBLE_CMP_OP(double, int64_t) DEFINE_LONG_DOUBLE_CMP_OP(int64_t, double) DEFINE_LONG_DOUBLE_CMP_OP(uint64_t, double) + #undef DEFINE_LONG_DOUBLE_CMP_OP - -#else - // ... otherwise, use external handlers - template <class xop> static OCTAVE_API bool mop (uint64_t, double); - template <class xop> static OCTAVE_API bool mop (int64_t, double); - template <class xop> static OCTAVE_API bool mop (double, uint64_t); - template <class xop> static OCTAVE_API bool mop (double, int64_t); -#endif - }; // Base integer class. No data, just conversion methods and exception flags.