f0fe0726b2223e2ba66530dcdc03c9dce184dbe5
[sbcl.git] / src / compiler / generic / interr.lisp
1 ;;;; This file defines all of the internal errors. How they are
2 ;;;; handled is defined in .../code/interr.lisp. How they are signaled
3 ;;;; depends on the machine.
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
13
14 (in-package "SB!KERNEL")
15
16 (defun error-number-or-lose (name)
17   (or (position name sb!c:*backend-internal-errors* :key #'car)
18       (error "unknown internal error: ~S" name)))
19
20 ;;; FIXME: Having each of these error handlers be a full, named function
21 ;;; seems to contribute a noticeable amount of bloat and little value.
22 ;;; Perhaps we could just make a single error-handling function with a
23 ;;; big CASE statement inside it?
24 (eval-when (:compile-toplevel :execute)
25   (def!macro define-internal-errors (&rest errors)
26              (let ((info (mapcar #'(lambda (x)
27                                      (if x
28                                        (cons (symbolicate (first x) "-ERROR")
29                                              (second x))
30                                        '(nil . "unused")))
31                                  errors)))
32                `(progn
33                   (setf sb!c:*backend-internal-errors*
34                         ',(coerce info 'vector))
35                   nil))))
36
37 (define-internal-errors
38   (unknown
39    "unknown system lossage")
40   (object-not-function
41    "Object is not of type FUNCTION.")
42   (object-not-list
43    "Object is not of type LIST.")
44   (object-not-bignum
45    "Object is not of type BIGNUM.")
46   (object-not-ratio
47    "Object is not of type RATIO.")
48   (object-not-single-float
49    "Object is not of type SINGLE-FLOAT.")
50   (object-not-double-float
51    "Object is not of type DOUBLE-FLOAT.")
52   #!+long-float
53   (object-not-long-float
54    "Object is not of type LONG-FLOAT.")
55   (object-not-simple-string
56    "Object is not of type SIMPLE-STRING.")
57   (object-not-simple-bit-vector
58    "Object is not of type SIMPLE-BIT-VECTOR.")
59   (object-not-simple-vector
60    "Object is not of type SIMPLE-VECTOR.")
61   (object-not-fixnum
62    "Object is not of type FIXNUM.")
63   (object-not-function-or-symbol
64    "Object is not of type FUNCTION or SYMBOL.")
65   (object-not-vector
66    "Object is not of type VECTOR.")
67   (object-not-string
68    "Object is not of type STRING.")
69   (object-not-bit-vector
70    "Object is not of type BIT-VECTOR.")
71   (object-not-array
72    "Object is not of type ARRAY.")
73   (object-not-number
74    "Object is not of type NUMBER.")
75   (object-not-rational
76    "Object is not of type RATIONAL.")
77   (object-not-float
78    "Object is not of type FLOAT.")
79   (object-not-real
80    "Object is not of type REAL.")
81   (object-not-integer
82    "Object is not of type INTEGER.")
83   (object-not-cons
84    "Object is not of type CONS.")
85   (object-not-symbol
86    "Object is not of type SYMBOL.")
87   (undefined-symbol
88    ;; FIXME: Isn't this used for calls to unbound (SETF FOO) too? If so, revise
89    ;; the name.
90    "An attempt was made to use an undefined FDEFINITION.")
91   (object-not-coerceable-to-function
92    "Object is not coerceable to type FUNCTION.")
93   (invalid-argument-count
94    "invalid argument count")
95   (bogus-argument-to-values-list
96    "bogus argument to VALUES-LIST")
97   (unbound-symbol
98    "An attempt was made to use an undefined SYMBOL-VALUE.")
99   ;; FIXME: We shouldn't need these placeholder NIL entries any more
100   ;; now that we pass our magic numbers cleanly through sbcl.h.
101   nil 
102   (object-not-sap
103    "Object is not a System Area Pointer (SAP).")
104   (invalid-unwind
105    "attempt to RETURN-FROM a block that no longer exists")
106   (unseen-throw-tag
107    "attempt to THROW to a non-existent tag")
108   (division-by-zero
109    "division by zero")
110   (object-not-type
111    "Object is of the wrong type.")
112   (odd-key-arguments
113    "odd number of &KEY arguments")
114   (unknown-key-argument
115    "unknown &KEY argument")
116   nil
117   nil
118   (invalid-array-index
119    "invalid array index")
120   (wrong-number-of-indices
121    "wrong number of indices")
122   (object-not-simple-array
123    "Object is not of type SIMPLE-ARRAY.")
124   (object-not-signed-byte-32
125    "Object is not of type (SIGNED-BYTE 32).")
126   (object-not-unsigned-byte-32
127    "Object is not of type (UNSIGNED-BYTE 32).")
128   (object-not-simple-array-unsigned-byte-2
129    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 2) (*)).")
130   (object-not-simple-array-unsigned-byte-4
131    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 4) (*)).")
132   (object-not-simple-array-unsigned-byte-8
133    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).")
134   (object-not-simple-array-unsigned-byte-16
135    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 16) (*)).")
136   (object-not-simple-array-unsigned-byte-32
137    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 32) (*)).")
138   (object-not-simple-array-signed-byte-8
139    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 8) (*)).")
140   (object-not-simple-array-signed-byte-16
141    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 16) (*)).")
142   (object-not-simple-array-signed-byte-30
143    "Object is not of type (SIMPLE-ARRAY FIXNUM (*)).")
144   (object-not-simple-array-signed-byte-32
145    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 32) (*)).")
146   (object-not-simple-array-single-float
147    "Object is not of type (SIMPLE-ARRAY SINGLE-FLOAT (*)).")
148   (object-not-simple-array-double-float
149    "Object is not of type (SIMPLE-ARRAY DOUBLE-FLOAT (*)).")
150   #!+long-float
151   (object-not-simple-array-long-float
152    "Object is not of type (SIMPLE-ARRAY LONG-FLOAT (*)).")
153   (object-not-simple-array-complex-single-float
154    "Object is not of type (SIMPLE-ARRAY (COMPLEX SINGLE-FLOAT) (*)).")
155   (object-not-simple-array-complex-double-float
156    "Object is not of type (SIMPLE-ARRAY (COMPLEX DOUBLE-FLOAT) (*)).")
157   #!+long-float
158   (object-not-simple-array-complex-long-float
159    "Object is not of type (SIMPLE-ARRAY (COMPLEX LONG-FLOAT) (*)).")
160   (object-not-complex
161    "Object is not of type COMPLEX.")
162   (object-not-complex-rational
163    "Object is not of type (COMPLEX RATIONAL).")
164   (object-not-complex-float
165    "Object is not of type (COMPLEX FLOAT).")
166   (object-not-complex-single-float
167    "Object is not of type (COMPLEX SINGLE-FLOAT).")
168   (object-not-complex-double-float
169    "Object is not of type (COMPLEX DOUBLE-FLOAT).")
170   #!+long-float
171   (object-not-complex-long-float
172    "Object is not of type (COMPLEX LONG-FLOAT).")
173   (object-not-weak-pointer
174    "Object is not a WEAK-POINTER.")
175   (object-not-instance
176    "Object is not a INSTANCE.")
177   (object-not-base-char
178    "Object is not of type BASE-CHAR.")
179   (nil-function-returned
180    "A function with declared result type NIL returned.")
181   (layout-invalid
182    "Object layout is invalid. (indicates obsolete instance)")
183   (object-not-complex-vector
184    "Object is not a complex (non-SIMPLE-ARRAY) vector."))