Consolidate existing warnings about unused return values
Move the warning about unused return values from calls to side-effect-free functions from the source-level optimiser to the code generator, where it can be unified with the special-purpose warning about unused values from `mapcar`. This change also cures spurious duplicate warnings about the same code, makes the warnings amenable to suppression through `with-suppressed-warnings`, and now warns about some unused values that weren't caught before. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Move warning away from here. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Doc string updates. (byte-compile-form): Put the new warnings here. (byte-compile-normal-call): Move mapcar warning away from here. * lisp/emacs-lisp/bytecomp.el (byte-compile-ignore): Compile args to `ignore` for value to avoid unused-value warnings, and then discard the generated values immediately thereafter. Mostly this does not affect the generated code but in rare cases it might result in slightly worse code. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Adapt test.
This commit is contained in:
parent
10b58633b5
commit
aef996cd34
4 changed files with 36 additions and 22 deletions
|
@ -650,11 +650,8 @@ in `byte-compile-warning-types'; see the variable
|
|||
`byte-compile-warnings' for a fuller explanation of the warning
|
||||
types. The types that can be suppressed with this macro are
|
||||
`free-vars', `callargs', `redefine', `obsolete',
|
||||
`interactive-only', `lexical', `mapcar', `constants',
|
||||
`suspicious' and `empty-body'.
|
||||
|
||||
For the `mapcar' case, only the `mapcar' function can be used in
|
||||
the symbol list."
|
||||
`interactive-only', `lexical', `ignored-return-value', `constants',
|
||||
`suspicious' and `empty-body'."
|
||||
;; Note: during compilation, this definition is overridden by the one in
|
||||
;; byte-compile-initial-macro-environment.
|
||||
(declare (debug (sexp body)) (indent 1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue