0.8.0.78.vector-nil-string.1:
[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? Or at least implement the error handling
24 ;;; functions as closures instead of DEFUNs?
25 (eval-when (:compile-toplevel :execute)
26   (def!macro define-internal-errors (&rest errors)
27              (let ((info (mapcar (lambda (x)
28                                    ;; FIXME: We shouldn't need placeholder
29                                    ;; NIL entries any more now that we
30                                    ;; pass our magic numbers cleanly
31                                    ;; through sbcl.h.
32                                    (if x
33                                        (cons (symbolicate (first x) "-ERROR")
34                                              (second x))
35                                        '(nil . "unused")))
36                                  errors)))
37                `(progn
38                   (setf sb!c:*backend-internal-errors*
39                         ',(coerce info 'vector))
40                   nil))))
41
42 (define-internal-errors
43   (unknown
44    "unknown system lossage")
45   (object-not-fun
46    "Object is not of type FUNCTION.")
47   (object-not-list
48    "Object is not of type LIST.")
49   (object-not-bignum
50    "Object is not of type BIGNUM.")
51   (object-not-ratio
52    "Object is not of type RATIO.")
53   (object-not-single-float
54    "Object is not of type SINGLE-FLOAT.")
55   (object-not-double-float
56    "Object is not of type DOUBLE-FLOAT.")
57   #!+long-float
58   (object-not-long-float
59    "Object is not of type LONG-FLOAT.")
60   (object-not-simple-string
61    "Object is not of type SIMPLE-STRING.")
62   (object-not-simple-base-string
63    "Object is not of type SIMPLE-BASE-STRING.")
64   (object-not-simple-bit-vector
65    "Object is not of type SIMPLE-BIT-VECTOR.")
66   (object-not-simple-vector
67    "Object is not of type SIMPLE-VECTOR.")
68   (object-not-fixnum
69    "Object is not of type FIXNUM.")
70   (object-not-vector
71    "Object is not of type VECTOR.")
72   (object-not-string
73    "Object is not of type STRING.")
74   (object-not-base-string
75    "Object is not of type BASE-STRING.")
76   (object-not-bit-vector
77    "Object is not of type BIT-VECTOR.")
78   (object-not-array
79    "Object is not of type ARRAY.")
80   (object-not-number
81    "Object is not of type NUMBER.")
82   (object-not-rational
83    "Object is not of type RATIONAL.")
84   (object-not-float
85    "Object is not of type FLOAT.")
86   (object-not-real
87    "Object is not of type REAL.")
88   (object-not-integer
89    "Object is not of type INTEGER.")
90   (object-not-cons
91    "Object is not of type CONS.")
92   (object-not-symbol
93    "Object is not of type SYMBOL.")
94   (undefined-fun
95    ;; FIXME: Isn't this used for calls to unbound (SETF FOO) too? If so, revise
96    ;; the name.
97    "An attempt was made to use an undefined FDEFINITION.")
98   (invalid-arg-count
99    "invalid argument count")
100   (bogus-arg-to-values-list
101    "bogus argument to VALUES-LIST")
102   (unbound-symbol
103    "An attempt was made to use an undefined SYMBOL-VALUE.")
104   (object-not-sap
105    "Object is not a System Area Pointer (SAP).")
106   (invalid-unwind
107    "attempt to RETURN-FROM a block that no longer exists")
108   (unseen-throw-tag
109    "attempt to THROW to a non-existent tag")
110   (division-by-zero
111    "division by zero")
112   (object-not-type
113    "Object is of the wrong type.")
114   (odd-key-args
115    "odd number of &KEY arguments")
116   (unknown-key-arg
117    "unknown &KEY argument")
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-nil
129    "Object is not of type (SIMPLE-ARRAY NIL (*)).")
130   (object-not-simple-array-unsigned-byte-2
131    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 2) (*)).")
132   (object-not-simple-array-unsigned-byte-4
133    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 4) (*)).")
134   (object-not-simple-array-unsigned-byte-8
135    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).")
136   (object-not-simple-array-unsigned-byte-16
137    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 16) (*)).")
138   (object-not-simple-array-unsigned-byte-32
139    "Object is not of type (SIMPLE-ARRAY (UNSIGNED-BYTE 32) (*)).")
140   (object-not-simple-array-signed-byte-8
141    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 8) (*)).")
142   (object-not-simple-array-signed-byte-16
143    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 16) (*)).")
144   (object-not-simple-array-signed-byte-30
145    "Object is not of type (SIMPLE-ARRAY FIXNUM (*)).")
146   (object-not-simple-array-signed-byte-32
147    "Object is not of type (SIMPLE-ARRAY (SIGNED-BYTE 32) (*)).")
148   (object-not-simple-array-single-float
149    "Object is not of type (SIMPLE-ARRAY SINGLE-FLOAT (*)).")
150   (object-not-simple-array-double-float
151    "Object is not of type (SIMPLE-ARRAY DOUBLE-FLOAT (*)).")
152   #!+long-float
153   (object-not-simple-array-long-float
154    "Object is not of type (SIMPLE-ARRAY LONG-FLOAT (*)).")
155   (object-not-simple-array-complex-single-float
156    "Object is not of type (SIMPLE-ARRAY (COMPLEX SINGLE-FLOAT) (*)).")
157   (object-not-simple-array-complex-double-float
158    "Object is not of type (SIMPLE-ARRAY (COMPLEX DOUBLE-FLOAT) (*)).")
159   #!+long-float
160   (object-not-simple-array-complex-long-float
161    "Object is not of type (SIMPLE-ARRAY (COMPLEX LONG-FLOAT) (*)).")
162   (object-not-complex
163    "Object is not of type COMPLEX.")
164   (object-not-complex-rational
165    "Object is not of type (COMPLEX RATIONAL).")
166   (object-not-complex-float
167    "Object is not of type (COMPLEX FLOAT).")
168   (object-not-complex-single-float
169    "Object is not of type (COMPLEX SINGLE-FLOAT).")
170   (object-not-complex-double-float
171    "Object is not of type (COMPLEX DOUBLE-FLOAT).")
172   #!+long-float
173   (object-not-complex-long-float
174    "Object is not of type (COMPLEX LONG-FLOAT).")
175   (object-not-weak-pointer
176    "Object is not a WEAK-POINTER.")
177   (object-not-instance
178    "Object is not a INSTANCE.")
179   (object-not-base-char
180    "Object is not of type BASE-CHAR.")
181   (nil-fun-returned
182    "A function with declared result type NIL returned.")
183   (nil-array-accessed
184    "An array with element-type NIL was accessed.")
185   (layout-invalid
186    "Object layout is invalid. (indicates obsolete instance)")
187   (object-not-complex-vector
188    "Object is not a complex (non-SIMPLE-ARRAY) vector."))