Subject: 29.0.50; [PATCH] Declare struct predicates as pure functions

From: Andrea Corallo <[email-masked]>
Date: Wed, 01 Dec 2021 10:29:42 +0000

Hi all,

shouldn't we declare structure predicates as pure functions?

Proposed patch attached.

Thanks

  Andrea

>From 8382e2078295d6feb4abbe72cf671a61a84fc640 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <[email-masked]>
Date: Wed, 1 Dec 2021 11:23:25 +0100
Subject: [PATCH] * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Decl struct
 predicates as pure

---
 lisp/emacs-lisp/cl-macs.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 1852471bcb..9c9a778f04 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3050,7 +3050,7 @@ cl-defstruct
                             `(,predicate cl-x))))
     (when pred-form
       (push `(,defsym ,predicate (cl-x)
-               (declare (side-effect-free error-free))
+               (declare (side-effect-free error-free) (pure t))
                ,(if (eq (car pred-form) 'and)
                     (append pred-form '(t))
                   `(and ,pred-form t)))
-- 
2.20.1