1.0.19.23: COMPILER-WARN accepts conditions
[sbcl/pkhuong.git] / src / code / defbangtype.lisp
blobd59b7c1294603a2d020b9110c0b0a545a72e8b48
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB!KERNEL")
12 ;;;; the DEF!TYPE macro
14 ;;; DEF!TYPE = cold DEFTYPE, a version of DEFTYPE which at
15 ;;; build-the-cross-compiler time defines its macro both in the
16 ;;; cross-compilation host Lisp and in the target Lisp. Basically,
17 ;;; DEF!TYPE does something like
18 ;;; (DEFTYPE SB!XC:FOO ..)
19 ;;; #+SB-XC-HOST (SB!XC:DEFTYPE FOO ..)
20 ;;; except that it also automatically delays the SB!XC:DEFTYPE call,
21 ;;; if necessary, until the cross-compiler's DEFTYPE machinery has been
22 ;;; set up.
24 ;;; FIXME: This code was created by cut-and-paste from the
25 ;;; corresponding code for DEF!MACRO. DEF!TYPE and DEF!MACRO are
26 ;;; currently very parallel, and if we ever manage to rationalize the
27 ;;; use of UNCROSS in the cross-compiler, they should become
28 ;;; completely parallel, at which time they should be merged to
29 ;;; eliminate the duplicate code.
31 (defmacro def!type (name &rest rest)
32 `(progn
33 (deftype ,name ,@rest)
34 #+sb-xc-host
35 ,(let ((form `(sb!xc:deftype ,(uncross name) ,@rest)))
36 (if (boundp '*delayed-def!types*)
37 `(push ',form *delayed-def!types*)
38 form))))
40 ;;; machinery to implement DEF!TYPE delays
41 #+sb-xc-host
42 (progn
43 (/show "binding *DELAYED-DEF!TYPES*")
44 (defvar *delayed-def!types* nil)
45 (/show "done binding *DELAYED-DEF!TYPES*")
46 (defun force-delayed-def!types ()
47 (if (boundp '*delayed-def!types*)
48 (progn
49 (mapc #'eval *delayed-def!types*)
50 (makunbound '*delayed-def!types*))
51 ;; This condition is probably harmless if it comes up when
52 ;; interactively experimenting with the system by loading a
53 ;; source file into it more than once. But it's worth warning
54 ;; about it because it definitely shouldn't come up in an
55 ;; ordinary build process.
56 (warn "*DELAYED-DEF!TYPES* is already unbound."))))