diff options
| author | Noam Postavsky | 2016-12-02 00:03:57 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2016-12-10 16:00:01 -0500 |
| commit | e4ac4507968b839569b5ce12a9c4d0374dd46768 (patch) | |
| tree | 7f2b67fc7634ac47526dfab963d96c1e81a1ff53 | |
| parent | 08decbd04b8346323b80f0dea84a462fe1f46b3f (diff) | |
| download | emacs-e4ac4507968b839569b5ce12a9c4d0374dd46768.tar.gz emacs-e4ac4507968b839569b5ce12a9c4d0374dd46768.zip | |
Define struct predicate before acccesors
The accessor functions use the predicate function, which causes problems
when reloading after unload-feature: the compiler-macro property is
still present on the predicate symbol, and the compiler fails to find
the definition when trying to inline it into the accessor
function (Bug#25088).
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Move predicate definition
before field accessor definitions.
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c51ed9d8770..b3a60b1b225 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -2687,6 +2687,14 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2687 | (= safety 1)) | 2687 | (= safety 1)) |
| 2688 | (cons 'and (cl-cdddr pred-form)) | 2688 | (cons 'and (cl-cdddr pred-form)) |
| 2689 | `(,predicate cl-x)))) | 2689 | `(,predicate cl-x)))) |
| 2690 | (when pred-form | ||
| 2691 | (push `(cl-defsubst ,predicate (cl-x) | ||
| 2692 | (declare (side-effect-free error-free)) | ||
| 2693 | ,(if (eq (car pred-form) 'and) | ||
| 2694 | (append pred-form '(t)) | ||
| 2695 | `(and ,pred-form t))) | ||
| 2696 | forms) | ||
| 2697 | (push `(put ',name 'cl-deftype-satisfies ',predicate) forms)) | ||
| 2690 | (let ((pos 0) (descp descs)) | 2698 | (let ((pos 0) (descp descs)) |
| 2691 | (while descp | 2699 | (while descp |
| 2692 | (let* ((desc (pop descp)) | 2700 | (let* ((desc (pop descp)) |
| @@ -2741,14 +2749,6 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2741 | (setq pos (1+ pos)))) | 2749 | (setq pos (1+ pos)))) |
| 2742 | (setq slots (nreverse slots) | 2750 | (setq slots (nreverse slots) |
| 2743 | defaults (nreverse defaults)) | 2751 | defaults (nreverse defaults)) |
| 2744 | (when pred-form | ||
| 2745 | (push `(cl-defsubst ,predicate (cl-x) | ||
| 2746 | (declare (side-effect-free error-free)) | ||
| 2747 | ,(if (eq (car pred-form) 'and) | ||
| 2748 | (append pred-form '(t)) | ||
| 2749 | `(and ,pred-form t))) | ||
| 2750 | forms) | ||
| 2751 | (push `(put ',name 'cl-deftype-satisfies ',predicate) forms)) | ||
| 2752 | (and copier | 2752 | (and copier |
| 2753 | (push `(defalias ',copier #'copy-sequence) forms)) | 2753 | (push `(defalias ',copier #'copy-sequence) forms)) |
| 2754 | (if constructor | 2754 | (if constructor |