aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-11-01 15:57:12 +0100
committerMattias EngdegÄrd2020-11-01 18:22:11 +0100
commitd85e0df7adaa21e20d44e7bbca62fa91272506bd (patch)
tree9a1b488ccb65cb3e1b2d6e2aaac352c924ba245c
parentd8601684934e8c4b72002c7d84036ca48048187f (diff)
downloademacs-d85e0df7adaa21e20d44e7bbca62fa91272506bd.tar.gz
emacs-d85e0df7adaa21e20d44e7bbca62fa91272506bd.zip
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 @@
1147(let ((side-effect-free-fns 1147(let ((side-effect-free-fns
1148 '(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan 1148 '(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan
1149 assq 1149 assq
1150 bool-vector-count-consecutive bool-vector-count-population
1151 bool-vector-subsetp
1150 boundp buffer-file-name buffer-local-variables buffer-modified-p 1152 boundp buffer-file-name buffer-local-variables buffer-modified-p
1151 buffer-substring byte-code-function-p 1153 buffer-substring byte-code-function-p
1152 capitalize car-less-than-car car cdr ceiling char-after char-before 1154 capitalize car-less-than-car car cdr ceiling char-after char-before
1153 char-equal char-to-string char-width compare-strings 1155 char-equal char-to-string char-width compare-strings
1154 compare-window-configurations concat coordinates-in-window-p 1156 compare-window-configurations concat coordinates-in-window-p
1155 copy-alist copy-sequence copy-marker cos count-lines 1157 copy-alist copy-sequence copy-marker copysign cos count-lines
1156 current-time-string current-time-zone 1158 current-time-string current-time-zone
1157 decode-char 1159 decode-char
1158 decode-time default-boundp default-value documentation downcase 1160 decode-time default-boundp default-value documentation downcase
@@ -1165,22 +1167,22 @@
1165 frame-visible-p fround ftruncate 1167 frame-visible-p fround ftruncate
1166 get gethash get-buffer get-buffer-window getenv get-file-buffer 1168 get gethash get-buffer get-buffer-window getenv get-file-buffer
1167 hash-table-count 1169 hash-table-count
1168 int-to-string intern-soft 1170 int-to-string intern-soft isnan
1169 keymap-parent 1171 keymap-parent
1170 length line-beginning-position line-end-position 1172 lax-plist-get ldexp length line-beginning-position line-end-position
1171 local-variable-if-set-p local-variable-p locale-info 1173 local-variable-if-set-p local-variable-p locale-info
1172 log log10 logand logb logcount logior lognot logxor lsh 1174 log log10 logand logb logcount logior lognot logxor lsh
1173 make-byte-code make-list make-string make-symbol marker-buffer max 1175 make-byte-code make-list make-string make-symbol marker-buffer max
1174 member memq min minibuffer-selected-window minibuffer-window 1176 member memq memql min minibuffer-selected-window minibuffer-window
1175 mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string 1177 mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string
1176 parse-colon-path plist-get plist-member 1178 parse-colon-path plist-get plist-member
1177 prefix-numeric-value previous-window prin1-to-string propertize 1179 prefix-numeric-value previous-window prin1-to-string propertize
1178 degrees-to-radians 1180 degrees-to-radians
1179 radians-to-degrees rassq rassoc read-from-string regexp-quote 1181 radians-to-degrees rassq rassoc read-from-string regexp-opt
1180 region-beginning region-end reverse round 1182 regexp-quote region-beginning region-end reverse round
1181 sin sqrt string string< string= string-equal string-lessp 1183 sin sqrt string string< string= string-equal string-lessp
1182 string-search string-to-char 1184 string-search string-to-char
1183 string-to-number substring 1185 string-to-number string-to-syntax substring
1184 sxhash sxhash-equal sxhash-eq sxhash-eql 1186 sxhash sxhash-equal sxhash-eq sxhash-eql
1185 symbol-function symbol-name symbol-plist symbol-value string-make-unibyte 1187 symbol-function symbol-name symbol-plist symbol-value string-make-unibyte
1186 string-make-multibyte string-as-multibyte string-as-unibyte 1188 string-make-multibyte string-as-multibyte string-as-unibyte
@@ -1230,7 +1232,7 @@
1230 standard-case-table standard-syntax-table stringp subrp symbolp 1232 standard-case-table standard-syntax-table stringp subrp symbolp
1231 syntax-table syntax-table-p 1233 syntax-table syntax-table-p
1232 this-command-keys this-command-keys-vector this-single-command-keys 1234 this-command-keys this-command-keys-vector this-single-command-keys
1233 this-single-command-raw-keys 1235 this-single-command-raw-keys type-of
1234 user-real-login-name user-real-uid user-uid 1236 user-real-login-name user-real-uid user-uid
1235 vector vectorp visible-frame-list 1237 vector vectorp visible-frame-list
1236 wholenump window-configuration-p window-live-p 1238 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
896For an approximate inverse of this, see `key-description'." 896For an approximate inverse of this, see `key-description'."
897 ;; Don't use a defalias, since the `pure' property is true only for 897 ;; Don't use a defalias, since the `pure' property is true only for
898 ;; the calling convention of `kbd'. 898 ;; the calling convention of `kbd'.
899 (declare (pure t)) 899 (declare (pure t) (side-effect-free t))
900 ;; A pure function is expected to preserve the match data. 900 ;; A pure function is expected to preserve the match data.
901 (save-match-data (read-kbd-macro keys))) 901 (save-match-data (read-kbd-macro keys)))
902 902
@@ -4446,7 +4446,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
4446 4446
4447(defun string-replace (fromstring tostring instring) 4447(defun string-replace (fromstring tostring instring)
4448 "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs." 4448 "Replace FROMSTRING with TOSTRING in INSTRING each time it occurs."
4449 (declare (pure t)) 4449 (declare (pure t) (side-effect-free t))
4450 (when (equal fromstring "") 4450 (when (equal fromstring "")
4451 (signal 'wrong-length-argument fromstring)) 4451 (signal 'wrong-length-argument fromstring))
4452 (let ((start 0) 4452 (let ((start 0)