mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 12:21:25 -08:00
Use mutate-constant as warning identifier
* etc/NEWS: * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings) (byte-compile-form): * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Use the new warning name `mutate-constant` instead of using the somewhat overloaded `suspicious`.
This commit is contained in:
parent
c083fa5cf8
commit
9f856e4cd0
4 changed files with 10 additions and 8 deletions
2
etc/NEWS
2
etc/NEWS
|
|
@ -527,7 +527,7 @@ To avoid the warning, operate on an object created by the program
|
|||
instead.
|
||||
|
||||
This warning can be suppressed using 'with-suppressed-warnings' with
|
||||
the warning name 'suspicious'.
|
||||
the warning name 'mutate-constant'.
|
||||
|
||||
---
|
||||
*** Warn about more ignored function return values.
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ in `byte-compile-warning-types'; see the variable
|
|||
types. The types that can be suppressed with this macro are
|
||||
`free-vars', `callargs', `redefine', `obsolete',
|
||||
`interactive-only', `lexical', `ignored-return-value', `constants',
|
||||
`suspicious' and `empty-body'."
|
||||
`suspicious', `empty-body' and `mutate-constant'."
|
||||
;; Note: during compilation, this definition is overridden by the one in
|
||||
;; byte-compile-initial-macro-environment.
|
||||
(declare (debug (sexp body)) (indent 1))
|
||||
|
|
|
|||
|
|
@ -330,6 +330,8 @@ Elements of the list may be:
|
|||
This depends on the `docstrings' warning type.
|
||||
suspicious constructs that usually don't do what the coder wanted.
|
||||
empty-body body argument to a special form or macro is empty.
|
||||
mutate-constant
|
||||
code that mutates program constants such as quoted lists
|
||||
|
||||
If the list begins with `not', then the remaining elements specify warnings to
|
||||
suppress. For example, (not free-vars) will suppress the `free-vars' warning.
|
||||
|
|
@ -3498,7 +3500,7 @@ lambda-expression."
|
|||
(consp (nth 1 arg)))
|
||||
(arrayp arg))
|
||||
(byte-compile-warning-enabled-p
|
||||
'suspicious (car form)))
|
||||
'mutate-constant (car form)))
|
||||
(byte-compile-warn-x form "`%s' on constant %s (arg %d)"
|
||||
(car form)
|
||||
(if (consp arg) "list" (type-of arg))
|
||||
|
|
|
|||
|
|
@ -1522,31 +1522,31 @@ literals (Bug#20852)."
|
|||
(test-suppression
|
||||
'(defun zot ()
|
||||
(setcar '(1 2) 3))
|
||||
'((suspicious setcar))
|
||||
'((mutate-constant setcar))
|
||||
"Warning: `setcar' on constant list (arg 1)")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot ()
|
||||
(aset [1 2] 1 3))
|
||||
'((suspicious aset))
|
||||
'((mutate-constant aset))
|
||||
"Warning: `aset' on constant vector (arg 1)")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot ()
|
||||
(aset "abc" 1 ?d))
|
||||
'((suspicious aset))
|
||||
'((mutate-constant aset))
|
||||
"Warning: `aset' on constant string (arg 1)")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot (x y)
|
||||
(nconc x y '(1 2) '(3 4)))
|
||||
'((suspicious nconc))
|
||||
'((mutate-constant nconc))
|
||||
"Warning: `nconc' on constant list (arg 3)")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot ()
|
||||
(put-text-property 0 2 'prop 'val "abc"))
|
||||
'((suspicious put-text-property))
|
||||
'((mutate-constant put-text-property))
|
||||
"Warning: `put-text-property' on constant string (arg 5)")
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue