# HG changeset patch # User Jaroslav Hajek # Date 1235470505 -3600 # Node ID ab4db66e286fb482d35662a61955d11b09ff7c78 # Parent a909d8c01adfc9f341ae8e258dc8537dd187f098 workaround gcc 4.3 explicit instantiation bug in octave_int_cmp_op diff -r a909d8c01adf -r ab4db66e286f liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Feb 24 11:12:38 2009 +0100 +++ b/liboctave/ChangeLog Tue Feb 24 11:15:05 2009 +0100 @@ -1,3 +1,14 @@ +2009-02-23 Jaroslav Hajek + + * 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 * dDiagMatrix.cc (DiagMatrix::pseudo_inverse): New method. diff -r a909d8c01adf -r ab4db66e286f liboctave/oct-inttypes.cc --- a/liboctave/oct-inttypes.cc Tue Feb 24 11:12:38 2009 +0100 +++ b/liboctave/oct-inttypes.cc Tue Feb 24 11:15:05 2009 +0100 @@ -56,7 +56,7 @@ template 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::max (); // This converts to the nearest double. Unless there's an equality, the @@ -76,7 +76,7 @@ template 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::max (); static const double xxlo = std::numeric_limits::min (); @@ -123,7 +123,7 @@ template 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::op rop; return mop (y, x); @@ -131,7 +131,7 @@ template 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::op rop; return mop (y, x); @@ -499,8 +499,8 @@ } #define INSTANTIATE_INT64_DOUBLE_CMP_OP0(OP,T1,T2) \ - template OCTAVE_API bool \ - octave_int_cmp_op::mop (T1 x, T2 y) + template bool \ + octave_int_cmp_op::emulate_mop (T1 x, T2 y) #define INSTANTIATE_INT64_DOUBLE_CMP_OP(OP) \ INSTANTIATE_INT64_DOUBLE_CMP_OP0(OP, double, int64_t); \ diff -r a909d8c01adf -r ab4db66e286f liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Tue Feb 24 11:12:38 2009 +0100 +++ b/liboctave/oct-inttypes.h Tue Feb 24 11:15:05 2009 +0100 @@ -192,20 +192,29 @@ return xop::op (static_cast (x), \ static_cast (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 static OCTAVE_API bool \ + emulate_mop (T1, T2); \ + template \ + static bool \ + mop (T1 x, T2 y) \ + { \ + return emulate_mop (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 static OCTAVE_API bool mop (uint64_t, double); - template static OCTAVE_API bool mop (int64_t, double); - template static OCTAVE_API bool mop (double, uint64_t); - template static OCTAVE_API bool mop (double, int64_t); -#endif - }; // Base integer class. No data, just conversion methods and exception flags.