aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-05-13 13:49:07 +0200
committerMattias EngdegÄrd2023-05-13 14:30:59 +0200
commit9f856e4cd095c24cf4e6cadbc04efaf533e59f37 (patch)
treee12e307dddab95b24fc8ad2de68b244ea5b0be71
parentc083fa5cf80f711ac43dca1b6582aff1ad526e8e (diff)
downloademacs-9f856e4cd095c24cf4e6cadbc04efaf533e59f37.tar.gz
emacs-9f856e4cd095c24cf4e6cadbc04efaf533e59f37.zip
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`.
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/emacs-lisp/byte-run.el2
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el10
4 files changed, 10 insertions, 8 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 7d033b0b13e..b4846eb11b0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -527,7 +527,7 @@ To avoid the warning, operate on an object created by the program
527instead. 527instead.
528 528
529This warning can be suppressed using 'with-suppressed-warnings' with 529This warning can be suppressed using 'with-suppressed-warnings' with
530the warning name 'suspicious'. 530the warning name 'mutate-constant'.
531 531
532--- 532---
533*** Warn about more ignored function return values. 533*** Warn about more ignored function return values.
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 5b415c5e1f4..a377ec395e1 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -658,7 +658,7 @@ in `byte-compile-warning-types'; see the variable
658types. The types that can be suppressed with this macro are 658types. The types that can be suppressed with this macro are
659`free-vars', `callargs', `redefine', `obsolete', 659`free-vars', `callargs', `redefine', `obsolete',
660`interactive-only', `lexical', `ignored-return-value', `constants', 660`interactive-only', `lexical', `ignored-return-value', `constants',
661`suspicious' and `empty-body'." 661`suspicious', `empty-body' and `mutate-constant'."
662 ;; Note: during compilation, this definition is overridden by the one in 662 ;; Note: during compilation, this definition is overridden by the one in
663 ;; byte-compile-initial-macro-environment. 663 ;; byte-compile-initial-macro-environment.
664 (declare (debug (sexp body)) (indent 1)) 664 (declare (debug (sexp body)) (indent 1))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index d17f1c93a76..a192d599d1d 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -330,6 +330,8 @@ Elements of the list may be:
330 This depends on the `docstrings' warning type. 330 This depends on the `docstrings' warning type.
331 suspicious constructs that usually don't do what the coder wanted. 331 suspicious constructs that usually don't do what the coder wanted.
332 empty-body body argument to a special form or macro is empty. 332 empty-body body argument to a special form or macro is empty.
333 mutate-constant
334 code that mutates program constants such as quoted lists
333 335
334If the list begins with `not', then the remaining elements specify warnings to 336If the list begins with `not', then the remaining elements specify warnings to
335suppress. For example, (not free-vars) will suppress the `free-vars' warning. 337suppress. For example, (not free-vars) will suppress the `free-vars' warning.
@@ -3498,7 +3500,7 @@ lambda-expression."
3498 (consp (nth 1 arg))) 3500 (consp (nth 1 arg)))
3499 (arrayp arg)) 3501 (arrayp arg))
3500 (byte-compile-warning-enabled-p 3502 (byte-compile-warning-enabled-p
3501 'suspicious (car form))) 3503 'mutate-constant (car form)))
3502 (byte-compile-warn-x form "`%s' on constant %s (arg %d)" 3504 (byte-compile-warn-x form "`%s' on constant %s (arg %d)"
3503 (car form) 3505 (car form)
3504 (if (consp arg) "list" (type-of arg)) 3506 (if (consp arg) "list" (type-of arg))
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 9136a6cd9b3..a8809bda81c 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1522,31 +1522,31 @@ literals (Bug#20852)."
1522 (test-suppression 1522 (test-suppression
1523 '(defun zot () 1523 '(defun zot ()
1524 (setcar '(1 2) 3)) 1524 (setcar '(1 2) 3))
1525 '((suspicious setcar)) 1525 '((mutate-constant setcar))
1526 "Warning: `setcar' on constant list (arg 1)") 1526 "Warning: `setcar' on constant list (arg 1)")
1527 1527
1528 (test-suppression 1528 (test-suppression
1529 '(defun zot () 1529 '(defun zot ()
1530 (aset [1 2] 1 3)) 1530 (aset [1 2] 1 3))
1531 '((suspicious aset)) 1531 '((mutate-constant aset))
1532 "Warning: `aset' on constant vector (arg 1)") 1532 "Warning: `aset' on constant vector (arg 1)")
1533 1533
1534 (test-suppression 1534 (test-suppression
1535 '(defun zot () 1535 '(defun zot ()
1536 (aset "abc" 1 ?d)) 1536 (aset "abc" 1 ?d))
1537 '((suspicious aset)) 1537 '((mutate-constant aset))
1538 "Warning: `aset' on constant string (arg 1)") 1538 "Warning: `aset' on constant string (arg 1)")
1539 1539
1540 (test-suppression 1540 (test-suppression
1541 '(defun zot (x y) 1541 '(defun zot (x y)
1542 (nconc x y '(1 2) '(3 4))) 1542 (nconc x y '(1 2) '(3 4)))
1543 '((suspicious nconc)) 1543 '((mutate-constant nconc))
1544 "Warning: `nconc' on constant list (arg 3)") 1544 "Warning: `nconc' on constant list (arg 3)")
1545 1545
1546 (test-suppression 1546 (test-suppression
1547 '(defun zot () 1547 '(defun zot ()
1548 (put-text-property 0 2 'prop 'val "abc")) 1548 (put-text-property 0 2 'prop 'val "abc"))
1549 '((suspicious put-text-property)) 1549 '((mutate-constant put-text-property))
1550 "Warning: `put-text-property' on constant string (arg 5)") 1550 "Warning: `put-text-property' on constant string (arg 5)")
1551 ) 1551 )
1552 1552