X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefmacro.lisp;h=5bc4f4704d395178b38853e9a422713da476a08a;hb=2b0851c405b494143009f68e2bc7e91017a809d4;hp=a889710979ebb53036068b5ecc9c05b36340388d;hpb=a0a413499415738d23cc40baa44e9c404af54a94;p=sbcl.git diff --git a/src/code/defmacro.lisp b/src/code/defmacro.lisp index a889710..5bc4f47 100644 --- a/src/code/defmacro.lisp +++ b/src/code/defmacro.lisp @@ -33,18 +33,24 @@ name)) (with-unique-names (whole environment) (multiple-value-bind (new-body local-decs doc) - (parse-defmacro lambda-list whole body name 'defmacro - :environment environment) - (let ((def `(lambda (,whole ,environment) - ,@local-decs - (block ,name - ,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 (debug-namify "DEFMACRO ~S" name))) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (sb!c::%defmacro ',name #',def ',lambda-list ,doc ,debug-name))))))) + (parse-defmacro lambda-list whole body name 'defmacro + :environment 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)) + (debug-name (sb!c::debug-name 'macro-function name))) + `(eval-when (:compile-toplevel :load-toplevel :execute) + (sb!c::%defmacro ',name #',def ',lambda-list + ,doc ',debug-name))))))) (macrolet ((def (times set-p) @@ -91,12 +97,11 @@ (#.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 - #.sb!vm:closure-fun-header-widetag) + (%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)))) + (%simple-fun-name definition) debug-name)))) name)))) (progn (def (:load-toplevel :execute) #-sb-xc-host t #+sb-xc-host nil)