Silence byte-compiler warning with :read-only defstruct slots
* emacs-lisp/cl-macs.el (defstruct): Ignore argument to setf method if slot is read-only. Fixes: debbugs:9035
This commit is contained in:
parent
be39b8cc93
commit
0794775d0d
2 changed files with 9 additions and 2 deletions
|
@ -2396,8 +2396,10 @@ value, that slot cannot be set via `setf'.
|
|||
(push (cons accessor t) side-eff)
|
||||
(push (list 'define-setf-method accessor '(cl-x)
|
||||
(if (cadr (memq :read-only (cddr desc)))
|
||||
(list 'error (format "%s is a read-only slot"
|
||||
accessor))
|
||||
(list 'progn '(ignore cl-x)
|
||||
(list 'error
|
||||
(format "%s is a read-only slot"
|
||||
'accessor)))
|
||||
;; If cl is loaded only for compilation,
|
||||
;; the call to cl-struct-setf-expander would
|
||||
;; cause a warning because it may not be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue