2
在sbcl中,我知道在defun中同時使用&可選鍵和&鍵時,我可以消除預期的消息,但這似乎在defmacro中不起作用。 (我應該重新設計/重寫,我知道,但是這是遺留代碼)sbcl:defmacro中的馬弗風格警告
當我編譯這個文件......
(declaim (sb-ext:muffle-conditions style-warning))
(defun wilma (&optional wilma1 &key wilma2 wilma3)
(declare (ignore wilma1 wilma2 wilma3)))
(defmacro betty (&optional betty1 &key betty2 betty3)
(declare (ignore betty1 betty2 betty3)))
......發生這種情況:
home:~/sbcl/experiments/style-warning.d$ sbcl --noinform
* (compile-file "5.lisp")
; compiling file "/u/home/sbcl/experiments/style-warning.d/5.lisp" (written 09 OCT 2017 03:31:44 PM):
; compiling (DECLAIM (MUFFLE-CONDITIONS STYLE-WARNING))
; compiling (DEFUN WILMA ...)
; compiling (DEFMACRO BETTY ...)
; file: /u/home/sbcl/experiments/style-warning.d/5.lisp
; in: DEFMACRO BETTY
; (DEFMACRO BETTY (&OPTIONAL BETTY1 &KEY BETTY2 BETTY3)
; (DECLARE (IGNORE BETTY1 BETTY2 BETTY3)))
;
; caught STYLE-WARNING:
; &OPTIONAL and &KEY found in the same lambda list: (&OPTIONAL BETTY1 &KEY BETTY2
; BETTY3)
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
; /u/home/sbcl/experiments/style-warning.d/5.fasl written
; compilation finished in 0:00:00.018
#P"/u/home/sbcl/experiments/style-warning.d/5.fasl"
T
NIL
* (exit)
home:~/sbcl/experiments/style-warning.d$
我如何抑制這些診斷?
編輯1:
由於這是遺留代碼,我會只是按摩它SBCL就緒,然後息事寧人,沒有理由我不能做這樣的事情的任何代碼使用它:
home:~/sbcl/experiments/style-warning.d$ sbcl --noinform
* (with-open-file (*error-output* "/dev/null" :direction :output :if-exists :append)
(compile-file "5.lisp"))
; compiling file "/u/home/sbcl/experiments/style-warning.d/5.lisp" (written 09 OCT 2017 03:31:44 PM):
; compiling (DECLAIM (MUFFLE-CONDITIONS STYLE-WARNING))
; compiling (DEFUN WILMA ...)
; compiling (DEFMACRO BETTY ...)
; /u/home/sbcl/experiments/style-warning.d/5.fasl written
; compilation finished in 0:00:00.017
#P"/u/home/sbcl/experiments/style-warning.d/5.fasl"
T
NIL
* (exit)
home:~/sbcl/experiments/style-warning.d$
但是有什麼可以抑制宏定義中的樣式警告嗎?