changeset 10405:cc69a17ec801

remove integer math warnings
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 09 Mar 2010 08:06:30 +0100
parents b40a5fd3af41
children 0c8d2278c57f
files liboctave/ChangeLog liboctave/oct-inttypes.cc liboctave/oct-inttypes.h src/ChangeLog src/OPERATORS/op-int-conv.cc src/OPERATORS/op-int.h src/data.cc src/error.cc src/gripes.cc src/gripes.h src/ov-intx.h src/ov.cc
diffstat 12 files changed, 52 insertions(+), 308 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Sun Mar 07 22:26:45 2010 -0800
+++ b/liboctave/ChangeLog	Tue Mar 09 08:06:30 2010 +0100
@@ -1,3 +1,14 @@
+2010-03-09  Jaroslav Hajek  <highegg@gmail.com>
+
+	* oct-inttypes.h (octave_int_base::ftrunc, octave_int_base::fnon_int,
+	octave_int_base::fnan, octave_int_base::get_trunc_flag,
+	octave_int_base::get_nan_flag,
+	octave_int_base::get_non_int_flag,
+	octave_int_base::get_math_trunc_flag,
+	octave_int_base::clear_conv_flags): Remove.
+	Remove occurences of ftrunc, fnon_int and fnan eveywhere.
+	* oct-inttypes.cc: Ditto last sentence. Remove warning tests.
+
 2010-03-07  Soren Hauberg  <hauberg@gmail.com>
 
 	* dim-vector.h: New constructor accepting a C array of dimensions.
--- a/liboctave/oct-inttypes.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/liboctave/oct-inttypes.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -180,7 +180,6 @@
   return res;
 
 overflow:
-  ftrunc = true;
   return max_val ();
 }
 
@@ -240,7 +239,6 @@
     {
       if (res > static_cast<uint64_t> (max_val ()))
         {
-          ftrunc = true;
           return max_val ();
         }
       else
@@ -250,7 +248,6 @@
     {
       if (res > static_cast<uint64_t> (-min_val ()))
         {
-          ftrunc = true;
           return min_val ();
         }
       else
@@ -259,7 +256,6 @@
 
 
 overflow:
-  ftrunc = true;
   return positive ? max_val () : min_val ();
 
 }
@@ -622,11 +618,6 @@
 %!assert(intmax("int64")/intmin("int64"),int64(-1))
 %!assert(intmin("int64")/int64(-1),intmax("int64"))
 %!assert(int64(2**63),intmax("int64"))
-%!test
-%! wstate = warning("query", "Octave:int-convert-overflow");
-%! warning("on", "Octave:int-convert-overflow");
-%! fail("int64(2**63)","warning",".*")
-%! warning(wstate.state, "Octave:int-convert-overflow");
 %!assert(uint64(2**64),intmax("uint64"))
 %!test
 %! a = 1.9*2^61; b = uint64(a); b++; assert(b > a)
@@ -637,17 +628,7 @@
 %!test
 %! a = uint64(2**61) + 2; assert(1.25*a == (5*a)/4)
 %!assert(int32(2**31+0.5),intmax('int32'))
-%!test
-%! wstate = warning("query", "Octave:int-convert-overflow");
-%! warning("on", "Octave:int-convert-overflow");
-%! fail("int32(2**31+0.5)","warning",".*")
-%! warning(wstate.state, "Octave:int-convert-overflow");
 %!assert(int32(-2**31-0.5),intmin('int32'))
-%!test
-%! wstate = warning("query", "Octave:int-convert-overflow");
-%! warning("on", "Octave:int-convert-overflow");
-%! fail("int32(-2**31-0.5)","warning",".*")
-%! warning(wstate.state, "Octave:int-convert-overflow");
 %!assert((int64(2**62)+1)**1, int64(2**62)+1)
 %!assert((int64(2**30)+1)**2, int64(2**60+2**31) + 1)
 */
--- a/liboctave/oct-inttypes.h	Sun Mar 07 22:26:45 2010 -0800
+++ b/liboctave/oct-inttypes.h	Tue Mar 09 08:06:30 2010 +0100
@@ -246,12 +246,10 @@
       // elimination, but that should be a piece of cake for most compilers.
       if (chk_min::op (value, static_cast<S> (min_val ())))
         {
-          ftrunc = true;
           return min_val ();
         }
       else if (chk_max::op (value, static_cast<S> (max_val ())))
         {
-          ftrunc = true;
           return max_val ();
         }
       else
@@ -284,62 +282,24 @@
       static const S thmax = compute_threshold (static_cast<S> (max_val ()), max_val ());
       if (xisnan (value))
         {
-          fnan = true;
           return static_cast<T> (0);
         }
       else if (value < thmin)
         {
-          ftrunc = true;
           return min_val ();
         }
       else if (value > thmax)
         {
-          ftrunc = true;
           return max_val ();
         }
       else
         {
           S rvalue = xround (value);
-          if (rvalue != value) fnon_int = true;
           return static_cast<T> (rvalue);
         }
     }
-
-  // Exception flags rationale:
-  // There is little reason to distinguish math and conversion exceptions at
-  // octave_int level. Doing this would require special constructors for
-  // intermediate int results in math computations.
-  // 
-  // Boolean flags are used rather than a single flag, because raising a boolean
-  // flag is faster than masking an int flag (single mov versus mov, or, mov).
-  // Also, it is atomic, and thus thread-safe (but there is *one* flag for all
-  // threads).
-
-  static bool get_trunc_flag () { return ftrunc; }
-  static bool get_nan_flag () { return fnan; }
-  static bool get_non_int_flag () { return fnon_int; }
-  static void clear_conv_flags () 
-    { 
-      ftrunc = false;
-      fnan = false;
-      fnon_int = false;
-    }
-  // For compatibility.
-  static bool get_math_trunc_flag () { return ftrunc || fnan; }
-  static void clear_conv_flag () { clear_conv_flags (); }
-
-protected:
-
-  // Conversion flags.
-  static bool ftrunc;
-  static bool fnon_int;
-  static bool fnan;
 };
 
-template<class T> bool octave_int_base<T>::ftrunc = false;
-template<class T> bool octave_int_base<T>::fnon_int = false;
-template<class T> bool octave_int_base<T>::fnan = false;
-
 // Saturated (homogeneous) integer arithmetics. The signed and unsigned
 // implementations are significantly different, so we implement another layer
 // and completely specialize. Arithmetics inherits from octave_int_base so that
@@ -370,9 +330,8 @@
   lshift (T x, int n) { return x << n; }
 
   static T
-  minus (T x)
+  minus (T)
     {
-      if (x != 0) octave_int_base<T>::ftrunc = true;
       return static_cast<T> (0);
     }
 
@@ -385,7 +344,6 @@
       if (u < x)
         {
           u = octave_int_base<T>::max_val ();
-          octave_int_base<T>::ftrunc = true; 
         }
       return u;
     }
@@ -397,7 +355,6 @@
       if (u > x)
         {
           u = 0;
-          octave_int_base<T>::ftrunc = true; 
         }
       return u;
     }
@@ -426,7 +383,6 @@
         }
       else
         {
-          octave_int_base<T>::ftrunc = true; 
           return x ? octave_int_base<T>::max_val () : 0;
         }
     }
@@ -441,7 +397,6 @@
   long double p = static_cast<long double> (x) * static_cast<long double> (y);
   if (p > static_cast<long double> (octave_int_base<uint64_t>::max_val ()))
     {
-      octave_int_base<uint64_t>::ftrunc = true;
       return octave_int_base<uint64_t>::max_val ();
     }
   else
@@ -504,7 +459,6 @@
       if (y < 0) 
         {
           y = octave_int_base<T>::max_val ();
-          octave_int_base<T>::ftrunc = true;
         }
       return y;
 #else
@@ -517,7 +471,6 @@
           && x == octave_int_base<T>::min_val ())
         {
           y = octave_int_base<T>::max_val ();
-          octave_int_base<T>::ftrunc = true;
         }
       else
         y = (x < 0) ? -x : x;
@@ -551,7 +504,6 @@
       if (y == octave_int_base<T>::min_val ())
         {
           --y;
-          octave_int_base<T>::ftrunc = false;
         }
       return y;
 #else
@@ -560,7 +512,6 @@
           && x == octave_int_base<T>::min_val ())
         {
           y = octave_int_base<T>::max_val ();
-          octave_int_base<T>::ftrunc = true;
         }
       else
         y = -x;
@@ -580,7 +531,6 @@
       if ((ux & uy) < 0) 
         {
           u = octave_int_base<T>::max_val () + signbit (~u);
-          octave_int_base<T>::ftrunc = true;
         }
       return u;
 #else
@@ -591,7 +541,6 @@
           if (x < octave_int_base<T>::min_val () - y)
             {
               u = octave_int_base<T>::min_val ();
-              octave_int_base<T>::ftrunc = true;
             }
           else
             u = x + y;
@@ -601,7 +550,6 @@
           if (x > octave_int_base<T>::max_val () - y)
             {
               u = octave_int_base<T>::max_val ();
-              octave_int_base<T>::ftrunc = true;
             }
           else
             u = x + y;
@@ -624,7 +572,6 @@
       if ((ux & uy) < 0) 
         {
           u = octave_int_base<T>::max_val () + signbit (~u);
-          octave_int_base<T>::ftrunc = true;
         }
       return u;
 #else
@@ -635,7 +582,6 @@
           if (x > octave_int_base<T>::max_val () + y)
             {
               u = octave_int_base<T>::max_val ();
-              octave_int_base<T>::ftrunc = true;
             }
           else
             u = x - y;
@@ -645,7 +591,6 @@
           if (x < octave_int_base<T>::min_val () + y)
             {
               u = octave_int_base<T>::min_val ();
-              octave_int_base<T>::ftrunc = true;
             }
           else
             u = x - y;
@@ -673,7 +618,6 @@
       T z;
       if (y == 0)
         {
-          octave_int_base<T>::ftrunc = true;
           if (x < 0)
             z = octave_int_base<T>::min_val ();
           else if (x != 0)
@@ -686,7 +630,6 @@
           // This is a special case that overflows as well.
           if (y == -1 && x == octave_int_base<T>::min_val ())
             {
-              octave_int_base<T>::ftrunc = true;
               z = octave_int_base<T>::max_val ();
             }
           else
@@ -725,12 +668,10 @@
   // really be faster.
   if (p > static_cast<long double> (octave_int_base<int64_t>::max_val ()))
     {
-      octave_int_base<int64_t>::ftrunc = true;
       return octave_int_base<int64_t>::max_val ();
     }
   else if (p < static_cast<long double> (octave_int_base<int64_t>::min_val ()))
     {
-      octave_int_base<int64_t>::ftrunc = true;
       return octave_int_base<int64_t>::min_val ();
     }
   else
--- a/src/ChangeLog	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/ChangeLog	Tue Mar 09 08:06:30 2010 +0100
@@ -1,3 +1,27 @@
+
+2010-03-09  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-intx.h 
+	(OCTAVE_INT_NDARRAY_T::convert_gripe): Remove method.
+	(OCTAVE_INT_NDARRAY_T): Remove all uses.
+	(OCTAVE_INT_T::convert_gripe): Remove method.
+	(OCTAVE_INT_T): Remove all uses.
+	* ov.cc (convert_to_int_array, convert_to_octave_idx_type_array): 
+	Remove int conversion warnings.
+	* data.cc (NATIVE_REDUCTION_1): Ditto.
+
+	* OPERATORS/op-intx.h: Remove integer warning stubs.
+	* OPERATORS/opt-int-conv.cc: Ditto.
+
+	* gripes.cc (gripe_truncated_conversion,
+	gripe_binop_integer_math_truncated,
+	gripe_native_integer_math_truncated,
+	gripe_unop_integer_math_truncated, gripe_non_integer_conversion,
+	gripe_nan_conversion): Remove.
+	* gripes.h: Remove decls.
+	* error.cc (initialize_default_warning_state): Don't initialize
+	removed warnings.
+
 2010-03-07  Michael Goffioul  <michael.goffioul@gmail.com>
 
 	* gl-render.cc (draw_figure): disable depth test on the 3rd pass.
--- a/src/OPERATORS/op-int-conv.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/OPERATORS/op-int-conv.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -51,18 +51,7 @@
   { \
     CAST_CONV_ARG (const octave_ ## tfrom&); \
  \
-    octave_ ## tto ::clear_conv_flag (); \
     octave_ ## tto ## _matrix v2 = v.tto ## _array_value (); \
-    if (octave_ ## tto ::get_trunc_flag ()) \
-      gripe_truncated_conversion (v.type_name (). c_str (), \
-                                  v2.type_name (). c_str ()); \
-    if (octave_ ## tto ::get_nan_flag ()) \
-      gripe_nan_conversion (v.type_name (). c_str (), \
-                            v2.type_name (). c_str ()); \
-    if (octave_ ## tto ::get_non_int_flag ()) \
-      gripe_non_integer_conversion (v.type_name (). c_str (), \
-                                    v2.type_name (). c_str ()); \
-    octave_ ## tto ::clear_conv_flag (); \
     return new octave_ ## tto ## _matrix (v2); \
   }
 
--- a/src/OPERATORS/op-int.h	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/OPERATORS/op-int.h	Tue Mar 09 08:06:30 2010 +0100
@@ -28,10 +28,6 @@
     CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
     octave_value retval = octave_value \
       (v1.t1 ## _value () op v2.t2 ## _value ()); \
-    if (octave_ ## t3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## t3 ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -41,10 +37,6 @@
     CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
     octave_value retval = octave_value \
       (v1.e1 ## _value () op v2.e2 ## _value ()); \
-    if (octave_ ## t3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## t3 ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -53,10 +45,6 @@
   { \
     CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
     octave_value retval = octave_value (f (v1.t1 ## _value (), v2.t2 ## _value ())); \
-    if (octave_ ## t3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## t3 ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -65,10 +53,6 @@
   { \
     CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \
     octave_value retval = octave_value (f (v1.e1 ## _value (), v2.e2 ## _value ())); \
-    if (octave_ ## t3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (#op, v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## t3 ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -176,9 +160,6 @@
   { \
     CAST_UNOP_ARG (const octave_ ## TYPE ## _scalar &); \
     octave_value retval = octave_value (- v. TYPE ## _scalar_value ()); \
-    if (octave_ ## TYPE ::get_math_trunc_flag ()) \
-      gripe_unop_integer_math_truncated ("-", v.type_name (). c_str ()); \
-    octave_ ## TYPE ::clear_conv_flag (); \
     return retval; \
   } \
   DEFUNOP_OP (s_transpose, TYPE ## _scalar, /* no-op */) \
@@ -202,10 +183,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
-    if (octave_ ## T3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated ("/", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## T3 ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -219,10 +196,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
-    if (octave_ ## T3 ::get_math_trunc_flag ()) \
-          gripe_binop_integer_math_truncated ("\\", v1.type_name (). c_str (), \
-                                              v2.type_name (). c_str ()); \
-    octave_ ## T3 ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -236,10 +209,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v1.T1 ## scalar_value () / v2.T2 ## scalar_value ()); \
-    if (octave_ ## T3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ()); \
-    octave_ ## T3 ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -253,10 +222,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v2.T2 ## scalar_value () / v1.T1 ## scalar_value ()); \
-    if (octave_ ## T3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## T3 ::clear_conv_flag (); \
     return retval; \
   } \
 
@@ -360,10 +325,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v2.TS ## scalar_value () / v1.TS ## scalar_value ()); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated ("\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -373,10 +334,6 @@
     CAST_BINOP_ARGS (const octave_ ## TS ## scalar&, const octave_ ## TM ## matrix&); \
  \
     octave_value retval = octave_value (v1.TS ## scalar_value () / v2.TM ## array_value ()); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -390,10 +347,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v2.TM ## array_value () / v1.TS ## scalar_value ()); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -517,10 +470,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated ("/", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -546,10 +495,6 @@
       gripe_divide_by_zero (); \
  \
     octave_value retval = octave_value (v1.TM ## array_value () / v2.TS ## scalar_value ()); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated ("./", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -560,10 +505,6 @@
     CAST_BINOP_ARGS (const octave_ ## TM ## matrix&, const octave_ ## TS ## scalar&); \
     \
     octave_value retval = v2.TS ## scalar_value () / v1.TM ## array_value (); \
-    if (octave_ ## TI ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".^", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## TI ::clear_conv_flag (); \
     return retval; \
   }
 
@@ -678,9 +619,6 @@
   { \
     CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix &); \
     octave_value retval = octave_value (- v. TYPE ## _array_value ()); \
-    if (octave_ ## TYPE ::get_math_trunc_flag ()) \
-      gripe_unop_integer_math_truncated ("-", v.type_name (). c_str ()); \
-    octave_ ## TYPE ::clear_conv_flag (); \
     return retval; \
   } \
  \
@@ -729,10 +667,6 @@
     CAST_BINOP_ARGS (const octave_ ## T1 ## matrix&, const octave_ ## T2 ## matrix&); \
     \
     octave_value retval = octave_value (quotient (v2.T2 ## array_value (), v1.T1 ## array_value ())); \
-    if (octave_ ## T3 ::get_math_trunc_flag ()) \
-      gripe_binop_integer_math_truncated (".\\", v1.type_name (). c_str (), \
-                                          v2.type_name (). c_str ());   \
-    octave_ ## T3 ::clear_conv_flag (); \
     return retval; \
   }
 
--- a/src/data.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/data.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -1293,14 +1293,7 @@
       \
       if (! error_state) \
         { \
-          octave_ ## TYPE::clear_conv_flags (); \
           retval = tmp.FCN (DIM); \
-          if (octave_ ## TYPE::get_trunc_flag ()) \
-            { \
-              gripe_native_integer_math_truncated (#FCN, \
-                                                   octave_ ## TYPE::type_name ()); \
-              octave_ ## TYPE::clear_conv_flags (); \
-            } \
         } \
     }
 
--- a/src/error.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/error.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -1472,10 +1472,6 @@
   disable_warning ("Octave:str-to-num");
   disable_warning ("Octave:string-concat");
   disable_warning ("Octave:variable-switch-label");
-  disable_warning ("Octave:int-convert-nan");
-  disable_warning ("Octave:int-convert-non-int-val");
-  disable_warning ("Octave:int-convert-overflow");
-  disable_warning ("Octave:int-math-overflow");
   disable_warning ("Octave:complex-cmp-ops");
 }
 
--- a/src/gripes.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/gripes.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -205,37 +205,6 @@
 }
 
 void
-gripe_truncated_conversion (const char *srctype, const char *desttype)
-{
-  warning_with_id ("Octave:int-convert-overflow", 
-                   "data truncated converting from %s to %s",
-                   srctype, desttype);
-}
-
-void
-gripe_binop_integer_math_truncated (const char *op, const char *type1, const char *type2)
-{
-  warning_with_id ("Octave:int-math-overflow",
-                   "data truncated for %s by %s binary operator %s",
-                   type1, type2, op);
-}
-
-void
-gripe_native_integer_math_truncated (const char *fcn, const char *type)
-{
-  warning_with_id ("Octave:int-math-overflow",
-                   "data truncated for %s native %s operation",
-                   type, fcn);
-}
-
-void
-gripe_unop_integer_math_truncated (const char* op, const char *type)
-{
-  warning_with_id ("Octave:int-math-overflow",
-                   "data truncated for the %s unary operator %s", type, op);
-}
-
-void
 gripe_library_execution_error (void)
 {
   octave_exception_state = octave_no_exception;
@@ -245,21 +214,6 @@
 }
 
 void
-gripe_non_integer_conversion (const char *srctype, const char *desttype)
-{
-  warning_with_id ("Octave:int-convert-non-int-val", 
-                   "Conversion of non-integer value from %s to %s",
-                   srctype, desttype);
-}
-void
-gripe_nan_conversion (const char *srctype, const char *desttype)
-{
-  warning_with_id ("Octave:int-convert-nan", 
-                   "Conversion of NaN from %s to %s",
-                   srctype, desttype);
-}
-
-void
 gripe_invalid_inquiry_subscript (void)
 {
   error ("invalid dimension inquiry of a non-existent value");
--- a/src/gripes.h	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/gripes.h	Tue Mar 09 08:06:30 2010 +0100
@@ -106,24 +106,6 @@
                            const std::string& to);
 
 extern OCTINTERP_API void
-gripe_truncated_conversion (const char *srctype, const char *desttype);
-
-extern OCTINTERP_API void
-gripe_binop_integer_math_truncated (const char *op, const char *type1, const char *type2);
-
-extern OCTINTERP_API void
-gripe_native_integer_math_truncated (const char *fcn, const char *type);
-
-extern OCTINTERP_API void
-gripe_unop_integer_math_truncated (const char *op, const char *type);
-
-extern OCTINTERP_API void
-gripe_non_integer_conversion (const char *srctype, const char *desttype);
-
-extern OCTINTERP_API void
-gripe_nan_conversion (const char *srctype, const char *desttype);
-
-extern OCTINTERP_API void
 gripe_divide_by_zero (void);
 
 extern OCTINTERP_API void
--- a/src/ov-intx.h	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/ov-intx.h	Tue Mar 09 08:06:30 2010 +0100
@@ -70,47 +70,31 @@
 
   builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
 
-private:
-
-  template <class IM>
-  IM convert_gripe () const
-    {
-      typedef typename IM::element_type dest_el_type;
-      typedef intNDArray<OCTAVE_INT_T>::element_type src_el_type;
-      dest_el_type::clear_conv_flag ();
-      IM retval (matrix);
-      if (dest_el_type::get_trunc_flag ())
-        gripe_truncated_conversion (src_el_type::type_name (),
-                                    dest_el_type::type_name ());
-      dest_el_type::clear_conv_flag ();
-      return retval;
-    }
-
 public:
 
   int8NDArray
-  int8_array_value (void) const { return convert_gripe<int8NDArray> (); }
+  int8_array_value (void) const { return int8NDArray (matrix); }
 
   int16NDArray
-  int16_array_value (void) const { return convert_gripe<int16NDArray> (); }
+  int16_array_value (void) const { return int16NDArray (matrix); }
 
   int32NDArray
-  int32_array_value (void) const { return convert_gripe<int32NDArray> (); }
+  int32_array_value (void) const { return int32NDArray (matrix); }
 
   int64NDArray
-  int64_array_value (void) const { return convert_gripe<int64NDArray> (); }
+  int64_array_value (void) const { return int64NDArray (matrix); }
 
   uint8NDArray
-  uint8_array_value (void) const { return convert_gripe<uint8NDArray> (); }
+  uint8_array_value (void) const { return uint8NDArray (matrix); }
 
   uint16NDArray
-  uint16_array_value (void) const { return convert_gripe<uint16NDArray> (); }
+  uint16_array_value (void) const { return uint16NDArray (matrix); }
 
   uint32NDArray
-  uint32_array_value (void) const { return convert_gripe<uint32NDArray> (); }
+  uint32_array_value (void) const { return uint32NDArray (matrix); }
 
   uint64NDArray
-  uint64_array_value (void) const { return convert_gripe<uint64NDArray> (); }
+  uint64_array_value (void) const { return uint64NDArray (matrix); }
 
   double
   double_value (bool = false) const
@@ -305,26 +289,16 @@
   void increment (void) 
    { 
      matrix_ref() += OCTAVE_INT_T (1); 
-     if (OCTAVE_INT_T::get_math_trunc_flag ())
-       gripe_unop_integer_math_truncated ("++", type_name (). c_str ());
-
-      OCTAVE_INT_T::clear_conv_flag ();
    }
 
   void decrement (void)
    { 
      matrix_ref() -= OCTAVE_INT_T (1); 
-     if (OCTAVE_INT_T::get_math_trunc_flag ())
-       gripe_unop_integer_math_truncated ("--", type_name (). c_str ());
-      OCTAVE_INT_T::clear_conv_flag ();
    }
 
   void changesign (void)
    { 
      matrix_ref ().changesign (); 
-     if (OCTAVE_INT_T::get_math_trunc_flag ())
-       gripe_unop_integer_math_truncated ("-", type_name (). c_str ());
-      OCTAVE_INT_T::clear_conv_flag ();
    }
 
   idx_vector index_vector (void) const 
@@ -441,48 +415,31 @@
 
   builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
 
-private:
-
-  template <class IS>
-  IS convert_gripe () const
-    {
-      typedef IS dest_el_type;
-      typedef OCTAVE_INT_T src_el_type;
-      dest_el_type::clear_conv_flag ();
-      IS retval (scalar);
-
-      if (dest_el_type::get_trunc_flag ())
-        gripe_truncated_conversion (src_el_type::type_name (),
-                                    dest_el_type::type_name ());
-      dest_el_type::clear_conv_flag ();
-      return retval;
-    }
-
 public:
 
   octave_int8
-  int8_scalar_value (void) const { return convert_gripe<octave_int8> (); }
+  int8_scalar_value (void) const { return octave_int8 (scalar); }
 
   octave_int16
-  int16_scalar_value (void) const { return convert_gripe<octave_int16> (); }
+  int16_scalar_value (void) const { return octave_int16 (scalar); }
 
   octave_int32
-  int32_scalar_value (void) const { return convert_gripe<octave_int32> (); }
+  int32_scalar_value (void) const { return octave_int32 (scalar); }
 
   octave_int64
-  int64_scalar_value (void) const { return convert_gripe<octave_int64> (); }
+  int64_scalar_value (void) const { return octave_int64 (scalar); }
 
   octave_uint8
-  uint8_scalar_value (void) const { return convert_gripe<octave_uint8> (); }
+  uint8_scalar_value (void) const { return octave_uint8 (scalar); }
 
   octave_uint16
-  uint16_scalar_value (void) const { return convert_gripe<octave_uint16> (); }
+  uint16_scalar_value (void) const { return octave_uint16 (scalar); }
 
   octave_uint32
-  uint32_scalar_value (void) const { return convert_gripe<octave_uint32> (); }
+  uint32_scalar_value (void) const { return octave_uint32 (scalar); }
 
   octave_uint64
-  uint64_scalar_value (void) const { return convert_gripe<octave_uint64> (); }
+  uint64_scalar_value (void) const { return octave_uint64 (scalar); }
 
   int8NDArray
   int8_array_value (void) const
@@ -630,17 +587,11 @@
   void increment (void) 
    { 
      scalar += OCTAVE_INT_T (1); 
-     if (OCTAVE_INT_T::get_math_trunc_flag ())
-       gripe_unop_integer_math_truncated ("++", type_name (). c_str ());
-      OCTAVE_INT_T::clear_conv_flag ();
    }
 
   void decrement (void)
    { 
      scalar -= OCTAVE_INT_T (1); 
-     if (OCTAVE_INT_T::get_math_trunc_flag ())
-       gripe_unop_integer_math_truncated ("--", type_name (). c_str ());
-      OCTAVE_INT_T::clear_conv_flag ();
    }
 
   idx_vector index_vector (void) const { return idx_vector (scalar); }
--- a/src/ov.cc	Sun Mar 07 22:26:45 2010 -0800
+++ b/src/ov.cc	Tue Mar 09 08:06:30 2010 +0100
@@ -1549,15 +1549,9 @@
   Array<int> retval (A.dims ());
   octave_idx_type n = A.numel ();
 
-  octave_int<int>::clear_conv_flag ();
   for (octave_idx_type i = 0; i < n; i++)
     retval.xelem (i) = octave_int<int> (A.xelem (i));
 
-  if (octave_int<int>::get_trunc_flag ())
-    gripe_truncated_conversion (octave_int<T>::type_name (), "int");
-
-  octave_int<int>::clear_conv_flag ();
-
   return retval;
 }
 
@@ -1630,15 +1624,9 @@
   Array<octave_idx_type> retval (A.dims ());
   octave_idx_type n = A.numel ();
 
-  octave_int<int>::clear_conv_flag ();
   for (octave_idx_type i = 0; i < n; i++)
     retval.xelem (i) = octave_int<octave_idx_type> (A.xelem (i));
 
-  if (octave_int<int>::get_trunc_flag ())
-    gripe_truncated_conversion (octave_int<T>::type_name (), "int");
-
-  octave_int<int>::clear_conv_flag ();
-
   return retval;
 }