# HG changeset patch # User Aidan Kehoe # Date 1431165032 -3600 # Node ID eb1e15c9440bba3bc96f16bc750269287c68e5f5 # Parent d138e600aa3aa5a58d1f751a3ce7eeb977e1019c Be less misleading in errors, data.c src/ChangeLog addition: 2015-05-09 Aidan Kehoe * data.c (Flogand): * data.c (Flogior): * data.c (Frem): * data.c (Flsh): Give less misleading errors in all these functions, e.g. supplying #'integer-char-or-marker as the predicate on wrong-type-argument, when float would not be accepted. diff -r d138e600aa3a -r eb1e15c9440b src/ChangeLog --- a/src/ChangeLog Sat May 09 01:23:45 2015 +0100 +++ b/src/ChangeLog Sat May 09 10:50:32 2015 +0100 @@ -1,3 +1,13 @@ +2015-05-09 Aidan Kehoe + + * data.c (Flogand): + * data.c (Flogior): + * data.c (Frem): + * data.c (Flsh): + Give less misleading errors in all these functions, e.g. supplying + #'integer-char-or-marker as the predicate on wrong-type-argument, + when float would not be accepted. + 2015-05-09 Aidan Kehoe * lread.c (read_rational): diff -r d138e600aa3a -r eb1e15c9440b src/data.c --- a/src/data.c Sat May 09 01:23:45 2015 +0100 +++ b/src/data.c Sat May 09 10:50:32 2015 +0100 @@ -2695,7 +2695,7 @@ return make_fixnum (~0); while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) - args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); + args[0] = wrong_type_argument (Qinteger_char_or_marker_p, args[0]); result = args[0]; if (CHARP (result)) @@ -2705,7 +2705,7 @@ for (i = 1; i < nargs; i++) { while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) - args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); + args[i] = wrong_type_argument (Qinteger_char_or_marker_p, args[i]); other = args[i]; switch (promote_args (&result, &other)) { @@ -2747,7 +2747,7 @@ return make_fixnum (0); while (!(CHARP (args[0]) || MARKERP (args[0]) || INTEGERP (args[0]))) - args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]); + args[0] = wrong_type_argument (Qinteger_char_or_marker_p, args[0]); result = args[0]; if (CHARP (result)) @@ -2757,7 +2757,7 @@ for (i = 1; i < nargs; i++) { while (!(CHARP (args[i]) || MARKERP (args[i]) || INTEGERP (args[i]))) - args[i] = wrong_type_argument (Qnumber_char_or_marker_p, args[i]); + args[i] = wrong_type_argument (Qinteger_char_or_marker_p, args[i]); other = args[i]; switch (promote_args (&result, &other)) { @@ -2862,9 +2862,9 @@ { #ifdef HAVE_BIGNUM while (!(CHARP (number1) || MARKERP (number1) || INTEGERP (number1))) - number1 = wrong_type_argument (Qnumber_char_or_marker_p, number1); + number1 = wrong_type_argument (Qinteger_char_or_marker_p, number1); while (!(CHARP (number2) || MARKERP (number2) || INTEGERP (number2))) - number2 = wrong_type_argument (Qnumber_char_or_marker_p, number2); + number2 = wrong_type_argument (Qinteger_char_or_marker_p, number2); if (promote_args (&number1, &number2) == FIXNUM_T) { @@ -3033,7 +3033,7 @@ { #ifdef HAVE_BIGNUM while (!(CHARP (value) || MARKERP (value) || INTEGERP (value))) - wrong_type_argument (Qnumber_char_or_marker_p, value); + wrong_type_argument (Qinteger_char_or_marker_p, value); CONCHECK_INTEGER (count); if (promote_args (&value, &count) == FIXNUM_T) @@ -3050,15 +3050,28 @@ if (bignum_sign (XBIGNUM_DATA (count)) <= 0) { bignum_neg (scratch_bignum, XBIGNUM_DATA (count)); + /* Sigh, this won't catch all overflows in the MPZ type under GMP, + and there's no way to hook into the library so that an overflow + errors rather than aborting. See + http://mid.gmane.org/5529.2096.e5823.ccba@parhasard.net . */ if (!bignum_fits_ulong_p (scratch_bignum)) - args_out_of_range (Qnumber_char_or_marker_p, count); + { + args_out_of_range_3 (count, + make_bignum_ll (- (long long)(ULONG_MAX)), + make_bignum_ll (ULONG_MAX)); + } bignum_rshift (scratch_bignum2, XBIGNUM_DATA (value), bignum_to_ulong (scratch_bignum)); } else { + /* See above re overflow. */ if (!bignum_fits_ulong_p (XBIGNUM_DATA (count))) - args_out_of_range (Qnumber_char_or_marker_p, count); + { + args_out_of_range_3 (count, + make_bignum_ll (- (long long) (ULONG_MAX)), + make_bignum_ll (ULONG_MAX)); + } bignum_lshift (scratch_bignum2, XBIGNUM_DATA (value), bignum_to_ulong (XBIGNUM_DATA (count))); }