(sb!c:with-source-location (source-location)
(setf (info :source-location :variable name) source-location))
name)
+
+;;; Needs WITH-COMPILATION-UNIT, hence not in toplevel.lisp.
+(defun load-script (pathname)
+ ;; WITH-COMPILATION-UNIT to avoid style-warnings for
+ ;; forward-referenced functions in scripts. Needs to be around
+ ;; HANDLING-END-OF-THE-WORLD so that we don't unwind from it, which
+ ;; would cause a bogus complaint about a fatal error...
+ (sb!xc:with-compilation-unit ()
+ (handling-end-of-the-world
+ (with-open-file (f pathname :element-type :default)
+ (sb!fasl::maybe-skip-shebang-line f)
+ (load f :verbose nil :print nil))
+ (quit))))
(dolist (option options)
(process-1 option)))))
-(defun process-script (script)
- (let ((pathname (native-pathname script)))
- (handling-end-of-the-world
- (with-open-file (f pathname :element-type :default)
- (sb!fasl::maybe-skip-shebang-line f)
- (load f :verbose nil :print nil)
- (quit)))))
-
;; Errors while processing the command line cause the system to QUIT,
;; instead of trying to go into the Lisp debugger, because trying to
;; go into the Lisp debugger would get into various annoying issues of
(process-init-file userinit :user))
(process-eval/load-options (nreverse reversed-options))
(when script
- (process-script script)
+ (load-script (native-pathname script))
(bug "PROCESS-SCRIPT returned")))
(abort ()
:report (lambda (s)
run_sbcl --script $tmpscript
check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)"
+echo '(setf *error-output* *standard-output*) (defun foo () (bar)) (defun bar () 11) (quit :unix-status (foo))'> $tmpscript
+out=`run_sbcl --script $tmpscript`
+check_status_maybe_lose "--script exit status from normal exit" $? 11 "(everything ok)"
+test -z "$out"
+check_status_maybe_lose "--script forward-referenced functions" $? 0 "(everything ok)"
+
rm -f $tmpscript
exit $EXIT_TEST_WIN
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.45.29"
+"1.0.45.30"