changeset 1995:4e6a63799f08

[xemacs-hg @ 2004-04-07 03:48:58 by james] Fix various ICC warnings and compilation errors.
author james
date Wed, 07 Apr 2004 03:49:00 +0000
parents cb7f3be19e9f
children ea0e08ca2c78
files src/ChangeLog src/bytecode.c src/data.c src/doprnt.c src/floatfns.c src/lread.c src/number-gmp.c src/number.c src/number.h
diffstat 9 files changed, 88 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/ChangeLog	Wed Apr 07 03:49:00 2004 +0000
@@ -1,3 +1,21 @@
+2004-04-06  Jerry James  <james@xemacs.org>
+
+	* bytecode.c (bytecode_arithcompare): Provide a default case to
+	silence ICC.
+	* bytecode.c (bytecode_arithop): Ditto.
+	* data.c (Fstring_to_number): Use Ibyte instead of char.
+	* data.c (Fmax): Cast from Ibyte to char as needed.
+	* data.c (Flogand): REALLY commit the previous patch to data.c.
+	* doprnt.c (emacs_doprnt_1): Use Ibyte instead of char.
+	* floatfns.c (Ffloor): Provide a default case to silence ICC.
+	* lread.c (parse_integer): Cast from Ibyte to char.
+	* number-gmp.c: Get the qxe_getpid prototype.
+	* number.c (string_to_bignum): Cast from Ibyte to char.
+	* number.c (get_number_type): ICC does not know that abort does
+	not return.
+	* number.c (internal_coerce_number): Ditto.
+	* number.h: Declare get_number_type.
+
 2004-04-06  Jerry James  <james@xemacs.org>
 
 	* number-mp.c (bignum_set_string): Read negative numbers correctly.
--- a/src/bytecode.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/bytecode.c	Wed Apr 07 03:49:00 2004 +0000
@@ -304,15 +304,15 @@
     case RATIO_T:
       return ratio_cmp (XRATIO_DATA (obj1), XRATIO_DATA (obj2));
 #endif
-    case FLOAT_T:
+#ifdef HAVE_BIGFLOAT
+    case BIGFLOAT_T:
+      return bigfloat_cmp (XBIGFLOAT_DATA (obj1), XBIGFLOAT_DATA (obj2));
+#endif
+    default: /* FLOAT_T */
       {
 	double dval1 = XFLOAT_DATA (obj1), dval2 = XFLOAT_DATA (obj2);
 	return dval1 < dval2 ? -1 : dval1 > dval2 ? 1 : 0;
       }
-#ifdef HAVE_BIGFLOAT
-    case BIGFLOAT_T:
-      return bigfloat_cmp (XBIGFLOAT_DATA (obj1), XBIGFLOAT_DATA (obj2));
-#endif
     }
 #else /* !WITH_NUMBER_TYPES */
   retry:
@@ -453,23 +453,6 @@
 	}
       return make_ratio_rt (scratch_ratio);
 #endif
-    case FLOAT_T:
-      {
-	double dval1 = XFLOAT_DATA (obj1), dval2 = XFLOAT_DATA (obj2);
-	switch (opcode)
-	  {
-	  case Bplus: dval1 += dval2; break;
-	  case Bdiff: dval1 -= dval2; break;
-	  case Bmult: dval1 *= dval2; break;
-	  case Bquo:
-	    if (dval2 == 0.0) Fsignal (Qarith_error, Qnil);
-	    dval1 /= dval2;
-	    break;
-	  case Bmax:  if (dval1 < dval2) dval1 = dval2; break;
-	  case Bmin:  if (dval1 > dval2) dval1 = dval2; break;
-	  }
-	return make_float (dval1);
-      }
 #ifdef HAVE_BIGFLOAT
     case BIGFLOAT_T:
       bigfloat_set_prec (scratch_bigfloat, max (XBIGFLOAT_GET_PREC (obj1),
@@ -503,6 +486,23 @@
 	}
       return make_bigfloat_bf (scratch_bigfloat);
 #endif
+    default: /* FLOAT_T */
+      {
+	double dval1 = XFLOAT_DATA (obj1), dval2 = XFLOAT_DATA (obj2);
+	switch (opcode)
+	  {
+	  case Bplus: dval1 += dval2; break;
+	  case Bdiff: dval1 -= dval2; break;
+	  case Bmult: dval1 *= dval2; break;
+	  case Bquo:
+	    if (dval2 == 0.0) Fsignal (Qarith_error, Qnil);
+	    dval1 /= dval2;
+	    break;
+	  case Bmax:  if (dval1 < dval2) dval1 = dval2; break;
+	  case Bmin:  if (dval1 > dval2) dval1 = dval2; break;
+	  }
+	return make_float (dval1);
+      }
     }
 #else /* !WITH_NUMBER_TYPES */
   EMACS_INT ival1, ival2;
--- a/src/data.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/data.c	Wed Apr 07 03:49:00 2004 +0000
@@ -1237,7 +1237,7 @@
 */
        (string, base))
 {
-  char *p;
+  Ibyte *p;
   int b;
 
   CHECK_STRING (string);
@@ -1251,24 +1251,24 @@
       check_int_range (b, 2, 16);
     }
 
-  p = (char *) XSTRING_DATA (string);
+  p = XSTRING_DATA (string);
 
   /* Skip any whitespace at the front of the number.  Some versions of
      atoi do this anyway, so we might as well make Emacs lisp consistent.  */
   while (*p == ' ' || *p == '\t')
     p++;
 
-  if (isfloat_string (p) && b == 10)
+  if (isfloat_string ((const char *) p) && b == 10)
     {
 #ifdef HAVE_BIGFLOAT
       if (ZEROP (Vdefault_float_precision))
 #endif
-	return make_float (atof (p));
+	return make_float (atof ((const char *) p));
 #ifdef HAVE_BIGFLOAT
       else
 	{
 	  bigfloat_set_prec (scratch_bigfloat, bigfloat_get_default_prec ());
-	  bigfloat_set_string (scratch_bigfloat, p, b);
+	  bigfloat_set_string (scratch_bigfloat, (const char *) p, b);
 	  return make_bigfloat_bf (scratch_bigfloat);
 	}
 #endif
@@ -1277,7 +1277,7 @@
 #ifdef HAVE_RATIO
   if (qxestrchr (p, '/') != NULL)
     {
-      ratio_set_string (scratch_ratio, p, b);
+      ratio_set_string (scratch_ratio, (const char *) p, b);
       return make_ratio_rt (scratch_ratio);
     }
 #endif /* HAVE_RATIO */
@@ -1286,7 +1286,7 @@
   /* GMP bignum_set_string returns random values when fed an empty string */
   if (*p == '\0')
     return make_int (0);
-  bignum_set_string (scratch_bignum, p, b);
+  bignum_set_string (scratch_bignum, (const char *) p, b);
   return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
 #else
   if (b == 10)
@@ -1795,7 +1795,6 @@
     args[0] = make_int (marker_position (args[0]));
   for (i = 1; i < nargs; i++)
     {
-    retry:
       comp1 = args[maxindex];
       comp2 = args[i];
       switch (promote_args (&comp1, &comp2))
@@ -1992,10 +1991,10 @@
       while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i])))
 	args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]);
       other = args[i];
-      switch (promote_args (&result & &other))
+      switch (promote_args (&result, &other))
 	{
 	case FIXNUM_T:
-	  result = make_int (XREALINT (result), XREALINT (other));
+	  result = make_int (XREALINT (result) & XREALINT (other));
 	  break;
 	case BIGNUM_T:
 	  bignum_and (scratch_bignum, XBIGNUM_DATA (result),
--- a/src/doprnt.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/doprnt.c	Wed Apr 07 03:49:00 2004 +0000
@@ -728,25 +728,29 @@
 #ifdef HAVE_BIGNUM
 	      if (BIGNUMP (arg.obj))
 		{
-		  char *text_to_print =
-		    bignum_to_string (XBIGNUM_DATA (arg.obj),
-				      ch == 'n' ? 10 :
-				      (ch == 'p' ? 8 : 16));
-		  doprnt_2 (stream, text_to_print, strlen (text_to_print),
+		  Ibyte *text_to_print =
+		    (Ibyte *) bignum_to_string (XBIGNUM_DATA (arg.obj),
+						ch == 'n' ? 10 :
+						(ch == 'p' ? 8 : 16));
+		  doprnt_2 (stream, text_to_print,
+			    strlen ((const char *) text_to_print),
 			    spec->minwidth, -1, spec->minus_flag,
 			    spec->zero_flag);
+		  xfree (text_to_print, Ibyte *);
 		}
 #endif
 #ifdef HAVE_RATIO
 	      if (RATIOP (arg.obj))
 		{
-		  char *text_to_print =
-		    ratio_to_string (XRATIO_DATA (arg.obj),
-				     ch == 'n' ? 10 :
-				     (ch == 'p' ? 8 : 16));
-		  doprnt_2 (stream, text_to_print, strlen (text_to_print),
+		  Ibyte *text_to_print =
+		    (Ibyte *) ratio_to_string (XRATIO_DATA (arg.obj),
+					       ch == 'n' ? 10 :
+					       (ch == 'p' ? 8 : 16));
+		  doprnt_2 (stream, text_to_print,
+			    strlen ((const char *) text_to_print),
 			    spec->minwidth, -1, spec->minus_flag,
 			    spec->zero_flag);
+		  xfree (text_to_print, Ibyte *);
 		}
 #endif
 	    }
@@ -754,10 +758,12 @@
 #ifdef HAVE_BIGFLOAT
 	  else if (strchr (bigfloat_converters, ch))
 	    {
-	      char *text_to_print =
-		bigfloat_to_string (XBIGFLOAT_DATA (arg.obj), 10);
-	      doprnt_2 (stream, text_to_print, strlen (text_to_print),
+	      Ibyte *text_to_print =
+		(Ibyte *) bigfloat_to_string (XBIGFLOAT_DATA (arg.obj), 10);
+	      doprnt_2 (stream, text_to_print,
+			strlen ((const char *) text_to_print),
 			spec->minwidth, -1, spec->minus_flag, spec->zero_flag);
+	      xfree (text_to_print, Ibyte *);
 	    }
 #endif /* HAVE_BIGFLOAT */
 	  else
--- a/src/floatfns.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/floatfns.c	Wed Apr 07 03:49:00 2004 +0000
@@ -950,17 +950,6 @@
 			XBIGNUM_DATA (divisor));
 	  return Fcanonicalize_number (make_bignum_bg (scratch_bignum));
 #endif
-	case FLOAT_T:
-	  {
-	    double f1 = extract_float (number);
-	    double f2 = extract_float (divisor);
-
-	    if (f2 == 0.0)
-	      Fsignal (Qarith_error, Qnil);
-
-	    IN_FLOAT2 (f1 = floor (f1 / f2), "floor", number, divisor);
-	    return float_to_int (f1, "floor", number, divisor);
-	  }
 #ifdef HAVE_RATIO
 	case RATIO_T:
 	  if (ratio_sign (XRATIO_DATA (divisor)) == 0)
@@ -983,6 +972,17 @@
 	  bigfloat_floor (scratch_bigfloat, scratch_bigfloat);
 	  return make_bigfloat_bf (scratch_bigfloat);
 #endif
+	default: /* FLOAT_T */
+	  {
+	    double f1 = extract_float (number);
+	    double f2 = extract_float (divisor);
+	    
+	    if (f2 == 0.0)
+	      Fsignal (Qarith_error, Qnil);
+	    
+	    IN_FLOAT2 (f1 = floor (f1 / f2), "floor", number, divisor);
+	    return float_to_int (f1, "floor", number, divisor);
+	  }
 	}
     }
 #else /* !WITH_NUMBER_TYPES */
--- a/src/lread.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/lread.c	Wed Apr 07 03:49:00 2004 +0000
@@ -1930,7 +1930,7 @@
  overflow:
 #ifdef HAVE_BIGNUM
   {
-    bignum_set_string (scratch_bignum, buf, 0);
+    bignum_set_string (scratch_bignum, (const char *) buf, 0);
     return make_bignum_bg (scratch_bignum);
   }
 #else
--- a/src/number-gmp.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/number-gmp.c	Wed Apr 07 03:49:00 2004 +0000
@@ -24,6 +24,7 @@
 #include <limits.h>
 #include <math.h>
 #include "lisp.h"
+#include "sysproc.h"    /* For qxe_getpid */
 
 static mpf_t float_print_min, float_print_max;
 gmp_randstate_t random_state;
--- a/src/number.c	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/number.c	Wed Apr 07 03:49:00 2004 +0000
@@ -85,7 +85,7 @@
 string_to_bignum(const Ibyte *str, Bytecount len, int base)
 {
   Lisp_Object b = make_bignum (0L);
-  return (bignum_set_string (XBIGNUM_DATA (b), str, base) < 0)
+  return (bignum_set_string (XBIGNUM_DATA (b), (const char *) str, base) < 0)
     ? Fsignal (Qinvalid_read_syntax,
 	       list3 (build_msg_string
 		      ("Invalid integer constant in reader"),
@@ -398,6 +398,8 @@
 #endif
   /* Catch unintentional bad uses of this function */
   abort ();
+  /* NOTREACHED */
+  return FIXNUM_T;
 }
 
 /* Convert NUMBER to type TYPE.  If TYPE is BIGFLOAT_T then use the indicated
@@ -513,7 +515,7 @@
       switch (type)
 	{
 	case FIXNUM_T:
-	  return Fround (number);
+	  return Ftruncate (number);
 	case BIGNUM_T:
 #ifdef HAVE_BIGNUM
 	  bignum_set_double (scratch_bignum, XFLOAT_DATA (number));
@@ -570,6 +572,8 @@
 #endif /* HAVE_BIGFLOAT */
     }
   abort ();
+  /* NOTREACHED */
+  return Qzero;
 }
 
 /* This function promotes its arguments as necessary to make them both the
--- a/src/number.h	Wed Apr 07 02:44:08 2004 +0000
+++ b/src/number.h	Wed Apr 07 03:49:00 2004 +0000
@@ -324,6 +324,7 @@
 
 enum number_type {FIXNUM_T, BIGNUM_T, RATIO_T, FLOAT_T, BIGFLOAT_T};
 
+extern enum number_type get_number_type (Lisp_Object);
 extern enum number_type promote_args (Lisp_Object *, Lisp_Object *);
 
 #endif /* INCLUDED_number_h_ */