X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefmacro.lisp;h=39ec97cfaf9e3a84abbdb12cd523f4f0cef98807;hb=65b5ab7e713d04e0d76bc0ee196374f6e57b922f;hp=21caf2d7612aefd9590b9961b815a40e8a830d6e;hpb=4898ef32c639b1c7f4ee13a5ba566ce6debd03e6;p=sbcl.git diff --git a/src/code/defmacro.lisp b/src/code/defmacro.lisp index 21caf2d..39ec97c 100644 --- a/src/code/defmacro.lisp +++ b/src/code/defmacro.lisp @@ -35,12 +35,18 @@ (multiple-value-bind (new-body local-decs doc) (parse-defmacro lambda-list whole body name 'defmacro :environment environment) - (let ((def `(lambda (,whole ,environment) + (let ((def `(#+sb-xc-host lambda + ;; Use a named-lambda rather than a lambda so that + ;; proper xref information can be stored. Use a + ;; list-based name, since otherwise the compiler + ;; will momentarily assume that it names a normal + ;; function, and report spurious warnings about + ;; redefinition a macro as a function, and then + ;; vice versa. + #-sb-xc-host named-lambda #-sb-xc-host (defmacro ,name) + (,whole ,environment) ,@local-decs ,new-body)) - ;; If we want to move over to list-style names - ;; [e.g. (DEFMACRO FOO), maybe to support some XREF-like - ;; functionality] here might be a good place to start. (debug-name (sb!c::debug-name 'macro-function name))) `(eval-when (:compile-toplevel :load-toplevel :execute) (sb!c::%defmacro ',name #',def ',lambda-list @@ -84,18 +90,11 @@ ;; will involve finding the old macro lambda-list ;; and comparing it with the new one. (style-warn "redefining ~S in DEFMACRO" name)) - (setf (sb!xc:macro-function name) definition - (fdocumentation name 'function) doc) + (setf (sb!xc:macro-function name) definition) ,(when set-p - `(case (widetag-of definition) - (#.sb!vm:closure-header-widetag - (setf (%simple-fun-arglist (%closure-fun definition)) - lambda-list - (%simple-fun-name (%closure-fun definition)) - debug-name)) - (#.sb!vm:simple-fun-header-widetag - (setf (%simple-fun-arglist definition) lambda-list - (%simple-fun-name definition) debug-name)))) + `(setf (%fun-doc definition) doc + (%fun-lambda-list definition) lambda-list + (%fun-name definition) debug-name)) name)))) (progn (def (:load-toplevel :execute) #-sb-xc-host t #+sb-xc-host nil)