1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; While most of SBCL is derived from the CMU CL system, the test
5 ;;;; files (like this one) were written from scratch after the fork
8 ;;;; This software is in the public domain and is provided with
9 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
10 ;;;; more information.
14 ;;; Check for fbound external symbols in public packages that have no
15 ;;; argument list information. (This used to be possible when we got
16 ;;; carried away with byte compilation, since the byte compiler can't
17 ;;; record argument list information. Now that there's no byte
18 ;;; compiler, that can't happen, but it still shouldn't hurt to check
19 ;;; in case the argument information goes astray some other way.)
20 (defvar *public-package-names*
21 '("SB-ALIEN" "SB-C-CALL" "SB-DEBUG" "SB-EXT" "SB-GRAY" "SB-MP"
22 "SB-PROFILE" "SB-PCL" "COMMON-LISP"))
23 (defun has-arglist-info-p (fun)
24 (declare (type function fun))
25 ;; The Lisp-level type FUNCTION can conceal a multitude of sins..
26 (case (sb-kernel:get-type fun)
27 ((#.sb-vm:simple-fun-header-widetag #.sb-vm:closure-fun-header-widetag)
28 (sb-kernel:%simple-fun-arglist fun))
29 (#.sb-vm:closure-header-widetag (has-arglist-info-p
30 (sb-kernel:%closure-fun fun)))
31 ;; In code/describe.lisp, ll. 227 (%describe-function), we use a scheme
32 ;; like above, and it seems to work. -- MNA 2001-06-12
34 ;; (There might be other cases with arglist info also.
35 ;; SIMPLE-FUN-HEADER-WIDETAG and CLOSURE-HEADER-WIDETAG just
36 ;; happen to be the two case that I had my nose rubbed in when
37 ;; debugging a GC problem caused by applying %SIMPLE-FUN-ARGLIST to
38 ;; a closure. -- WHN 2001-06-05)
40 (defun check-ext-symbols-arglist (package)
41 (format t "~% looking at package: ~A" package)
42 (do-external-symbols (ext-sym package)
43 (when (fboundp ext-sym)
44 (let ((fun (symbol-function ext-sym)))
45 (cond ((macro-function ext-sym)
46 ;; FIXME: Macro functions should have their argument list
47 ;; information checked separately. Just feeding them into
48 ;; the ordinary-function logic below doesn't work right,
49 ;; though, and I haven't figured out what does work
50 ;; right. For now we just punt.
53 ((sb-int:info :function :accessor-for ext-sym)
55 ((typep fun 'generic-function)
56 (sb-pcl::generic-function-pretty-arglist fun))
58 (let ((fun (symbol-function ext-sym)))
59 (unless (has-arglist-info-p fun)
60 (error "Function ~A has no arg-list information available."
62 (dolist (public-package *public-package-names*)
63 (when (find-package public-package)
64 (check-ext-symbols-arglist public-package)))
67 ;;; FIXME: It would probably be good to require here that every
68 ;;; external symbol either has a doc string or has some good excuse
69 ;;; (like being an accessor for a structure which has a doc string).