# HG changeset patch
# User Jaroslav Hajek
# Date 1235374787 -3600
# Node ID 527d53c475f2f05059a5564f10d5bf7561ff598a
# Parent d79edebd8f4526e4c67abc18996028151f91fc58
workaround gcc 4.3 explicit instantiation bug in octave_int_cmp_op
diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -0,0 +1,11 @@
+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.
+
diff --git a/liboctave/oct-inttypes.cc b/liboctave/oct-inttypes.cc
--- a/liboctave/oct-inttypes.cc
+++ b/liboctave/oct-inttypes.cc
@@ -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 --git a/liboctave/oct-inttypes.h b/liboctave/oct-inttypes.h
--- a/liboctave/oct-inttypes.h
+++ b/liboctave/oct-inttypes.h
@@ -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.