summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-11-01 15:57:12 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-11-01 18:22:11 +0100
commitd85e0df7adaa21e20d44e7bbca62fa91272506bd (patch)
tree9a1b488ccb65cb3e1b2d6e2aaac352c924ba245c
parentd8601684934e8c4b72002c7d84036ca48048187f (diff)
downloademacs-d85e0df7adaa21e20d44e7bbca62fa91272506bd.tar.gz
Add missing side-effect-free and error-free properties
Any function that is pure is also side-effect-free and some are also error-free. Right now these have to be declared separately. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add bool-vector-count-consecutive, bool-vector-count-population, bool-vector-subsetp, copysign, isnan, lax-plist-get, ldexp, memql, regexp-opt and string-to-syntax. (side-effect-and-error-free-fns): Add type-of. * lisp/subr.el (kbd, string-replace): Declare side-effect-free.
-rw-r--r--lisp/emacs-lisp/byte-opt.el18
-rw-r--r--lisp/subr.el4
2 files changed, 12 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 56b957384f9..530a086b14b 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1147,12 +1147,14 @@
(let ((side-effect-free-fns
'(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan
assq
+ bool-vector-count-consecutive bool-vector-count-population
+ bool-vector-subsetp
boundp buffer-file-name buffer-local-variables buffer-modified-p
buffer-substring byte-code-function-p
capitalize car-less-than-car car cdr ceiling char-after char-before
char-equal char-to-string char-width compare-strings
compare-window-configurations concat coordinates-in-window-p
- copy-alist copy-sequence copy-marker cos count-lines
+ copy-alist copy-sequence copy-marker copysign cos count-lines
current-time-string current-time-zone
decode-char
decode-time default-boundp default-value documentation downcase
@@ -1165,22 +1167,22 @@
frame-visible-p fround ftruncate
get gethash get-buffer get-buffer-window getenv get-file-buffer
hash-table-count
- int-to-string intern-soft
+ int-to-string intern-soft isnan
keymap-parent
- length line-beginning-position line-end-position
+ lax-plist-get ldexp length line-beginning-position line-end-position
local-variable-if-set-p local-variable-p locale-info
log log10 logand logb logcount logior lognot logxor lsh
make-byte-code make-list make-string make-symbol marker-buffer max
- member memq min minibuffer-selected-window minibuffer-window
+ member memq memql min minibuffer-selected-window minibuffer-window
mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string
parse-colon-path plist-get plist-member
prefix-numeric-value previous-window prin1-to-string propertize
degrees-to-radians
- radians-to-degrees rassq rassoc read-from-string regexp-quote
- region-beginning region-end reverse round
+ radians-to-degrees rassq rassoc read-from-string regexp-opt
+ regexp-quote region-beginning region-end reverse round
sin sqrt string string< string= string-equal string-lessp
string-search string-to-char
- string-to-number substring
+ string-to-number string-to-syntax substring
sxhash sxhash-equal sxhash-eq sxhash-eql
symbol-function symbol-name symbol-plist symbol-value string-make-unibyte
string-make-multibyte string-as-multibyte string-as-unibyte
@@ -1230,7 +1232,7 @@
standard-case-table standard-syntax-table stringp subrp symbolp
syntax-table syntax-table-p
this-command-keys this-command-keys-vector this-single-command-keys
- this-single-command-raw-keys
+ this-single-command-raw-keys type-of
user-real-login-name user-real-uid user-uid
vector vectorp visible-frame-list
wholenump window-configuration-p window-live-p
diff --git a/lisp/subr.el b/lisp/subr.el
index b7a746f2db0..286851dfc83 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -896,7 +896,7 @@ This is the same format used for saving keyboard macros (see
For an approximate inverse of this, see `key-description'."
;; Don't use a defalias, since the `pure' property is true only for
;; the calling convention of `kbd'.
- (declare (pure t))
+ (declare (pure t) (side-effect-free t))
;; A pure function is expected to preserve the match data.
(save-match-data (read-kbd-macro keys)))
@@ -4446,7 +4446,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
(defun string-replace (fromstring tostring instring)
"Replace FROMSTRING with TOSTRING in INSTRING each time it occurs."
- (declare (pure t))
+ (declare (pure t) (side-effect-free t))
(when (equal fromstring "")
(signal 'wrong-length-argument fromstring))
(let ((start 0)