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