1.0.29.30: oops, get documentation for built-in macros right
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 22 Jun 2009 08:05:46 +0000 (08:05 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 22 Jun 2009 08:05:46 +0000 (08:05 +0000)
* Reported by Harald Hanche-Olsen.

src/code/defmacro.lisp
src/code/macros.lisp
src/compiler/info-functions.lisp
src/pcl/documentation.lisp
tests/interface.impure.lisp
version.lisp-expr

index 0f43bd6..39ec97c 100644 (file)
                     ;; and comparing it with the new one.
                     (style-warn "redefining ~S in DEFMACRO" name))
             (setf (sb!xc:macro-function name) definition)
-            #-sb-xc-host
-            (when doc
-              (setf (%fun-doc definition) doc))
             ,(when set-p
-                   `(setf (%fun-lambda-list definition) lambda-list
+                   `(setf (%fun-doc definition) doc
+                          (%fun-lambda-list definition) lambda-list
                           (%fun-name definition) debug-name))
             name))))
   (progn
index 71d7bad..731d81f 100644 (file)
@@ -152,10 +152,9 @@ invoked. In that case it will store into PLACE and start over."
              ;; FIXME: warn about incompatible lambda list with
              ;; respect to parent function?
              (setf (sb!xc:compiler-macro-function name) definition)
-             #-sb-xc-host
-             (setf (%fun-doc definition) doc)
              ,(when set-p
-                    `(setf (%fun-lambda-list definition) lambda-list
+                    `(setf (%fun-doc definition) doc
+                           (%fun-lambda-list definition) lambda-list
                            (%fun-name definition) debug-name))
              name))))
   (progn
index 386441a..e67f1a2 100644 (file)
@@ -226,11 +226,13 @@ return NIL. Can be set with SETF when ENV is NIL."
     (variable
      (typecase x
        (symbol (values (info :variable :documentation x)))))
+    ;; FUNCTION is not used at the momemnt, just here for symmetry.
     (function
      (cond ((functionp x)
             (%fun-doc x))
-           ((legal-fun-name-p x)
-            (%fun-doc (fdefinition x)))))
+           ((and (legal-fun-name-p x) (fboundp x))
+            (%fun-doc (or (and (symbolp x) (macro-function x))
+                          (fdefinition x))))))
     (structure
      (typecase x
        (symbol (cond
index b06a53c..e1b7b56 100644 (file)
 
 (defmethod documentation ((x list) (doc-type (eql 'function)))
   (when (and (legal-fun-name-p x) (fboundp x))
-    (documentation (fdefinition x) t)))
+    (fun-doc (fdefinition x))))
 
 (defmethod documentation ((x list) (doc-type (eql 'compiler-macro)))
   (awhen (compiler-macro-function x)
     (documentation it t)))
 
 (defmethod documentation ((x symbol) (doc-type (eql 'function)))
-  (when (fboundp x)
-    (documentation (symbol-function x) t)))
+  (when (and (legal-fun-name-p x) (fboundp x))
+    (fun-doc (or (macro-function x) (fdefinition x)))))
 
 (defmethod documentation ((x symbol) (doc-type (eql 'compiler-macro)))
   (awhen (compiler-macro-function x)
index 785edcd..cdec390 100644 (file)
   (assert (string= (setf (documentation 'docfoo 'function) "baz") "baz"))
   (assert (string= (documentation 'docfoo 'function) "baz"))
   (assert (string= (documentation #'docfoo t) "baz")))
+
+#+sb-doc
+(with-test (:name (documentation built-in-macro))
+  (assert (documentation 'trace 'function)))
+
+#+sb-doc
+(with-test (:name (documentation built-in-function))
+  (assert (documentation 'cons 'function)))
 \f
 ;;;; success
index 1e89aa4..19133e5 100644 (file)
@@ -17,4 +17,4 @@
 ;;; 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.29.29"
+"1.0.29.30"