tests: Refactor CHECKED-COMPILE
[sbcl.git] / make-host-1.lisp
blobe6bc2694bff172e81153ba89da7523cabae89124
1 ;;; (We want to have some limit on print length and print level during
2 ;;; bootstrapping because PRINT-OBJECT only gets set up rather late,
3 ;;; and running without PRINT-OBJECT it's easy to fall into printing
4 ;;; enormous (or infinitely circular) low-level representations of
5 ;;; things.)
6 (setf *print-level* 5 *print-length* 5)
8 (progn (load "src/cold/shared.lisp")
9 (load "tools-for-build/ldso-stubs.lisp"))
10 (in-package "SB-COLD")
11 (progn
12 (setf *host-obj-prefix* "obj/from-host/")
13 (load "src/cold/set-up-cold-packages.lisp")
14 (load "src/cold/defun-load-or-cload-xcompiler.lisp")
16 ;; Supress function/macro redefinition warnings under clisp.
17 #+clisp (setf custom:*suppress-check-redefinition* t)
19 (defmacro maybe-with-compilation-unit (&body forms)
20 ;; A compilation-unit seems to kill the compile. I'm not sure if it's
21 ;; running out of memory or what. I don't care to find out,
22 ;; but it's most definitely the cause of the breakage.
23 #+clisp `(progn ,@forms)
25 #+sbcl
26 ;; Watch for deferred warnings under SBCL.
27 ;; UNDEFINED-VARIABLE does not cause COMPILE-FILE to return warnings-p
28 ;; unless outside a compilation unit. You find out about it only upon
29 ;; exit of SUMMARIZE-COMPILATION-UNIT. So we set up a handler for that.
30 `(let (in-summary fail)
31 (handler-bind (((and simple-warning (not style-warning))
32 (lambda (c)
33 ;; hack for PPC. See 'build-order.lisp-expr'
34 ;; Ignore the warning, and the warning about the warning.
35 (unless (or (search "not allowed by the operand type"
36 (simple-condition-format-control c))
37 (search "ignoring FAILURE-P return"
38 (simple-condition-format-control c)))
39 (setq fail 'warning))))
40 ;; Prevent regressions on a couple platforms
41 ;; that are known to build cleanly.
42 #!+(or x86 x86-64 arm64)
43 (sb-int:simple-style-warning
44 (lambda (c)
45 (when (and in-summary
46 (search "undefined"
47 (simple-condition-format-control c)))
48 (unless (eq fail 'warning)
49 (setq fail 'style-warning))))))
50 (with-compilation-unit ()
51 (multiple-value-prog1 (progn ,@forms) (setq in-summary t))))
52 (when fail
53 (cerror "Proceed anyway"
54 "make-host-1 stopped due to unexpected ~A." fail)))
56 #-(or clisp sbcl) `(with-compilation-unit () ,@forms))
58 ;; Now we can set the #[+-] readers to our precautionary
59 ;; readers that prohibit use of ":sbcl" as the condition.
60 (set-dispatch-macro-character #\# #\+ #'she-reader)
61 (set-dispatch-macro-character #\# #\- #'she-reader))
63 (maybe-with-compilation-unit
64 (load-or-cload-xcompiler #'host-cload-stem)
66 ;;; Let's check that the type system, and various other things, are
67 ;;; reasonably sane. (It's easy to spend a long time wandering around
68 ;;; confused trying to debug cross-compilation if it isn't.)
69 (load "tests/type.before-xc.lisp")
70 (load "tests/info.before-xc.lisp")
71 (load "tests/vm.before-xc.lisp")
72 ;; When building on a slow host using a slow Lisp,
73 ;; the wait time in slurp-ucd seems interminable - over a minute.
74 ;; Compiling seems to help a bit, but maybe it's my imagination.
75 (let ((object (compile-file "tools-for-build/ucd.lisp")))
76 (load object)
77 (delete-file object))
79 ;;; Generate character database tables.
80 (dolist (s '(sb-cold::slurp-ucd sb-cold::slurp-proplist sb-cold::output))
81 (funcall s))
83 ;;; propagate structure offset and other information to the C runtime
84 ;;; support code.
85 (host-cload-stem "src/compiler/generic/genesis" nil)
86 ) ; END with-compilation-unit
88 (sb-cold:genesis :c-header-dir-name "src/runtime/genesis")