GNU bug report logs -
#30499
26.0.91; Compiler warning cannot be suppressed
Previous Next
Reported by: f.j.wright <at> live.co.uk
Date: Sat, 17 Feb 2018 12:50:02 UTC
Severity: minor
Tags: fixed
Found in versions 26.0.91, 24.3
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #10 received at control <at> debbugs.gnu.org (full text, mbox):
found 30499 24.3
quit
Francis Wright <francis.j.wright <at> gmail.com> writes:
> (with-no-warnings (byte-compile '(:foo)))
I think it should rather be like this (shows the same warning):
(byte-compile (lambda () (with-no-warnings (:foo))))
> produces the warning
>
> Warning: ‘:foo’ called as a function
Seems to have been the case at least as far back as 24.3, and probably
farther.
> Setting byte-compile-warnings to nil also does not suppress this
> warning. So either the documentation or the operation of both
> with-no-warnings and byte-compile-warnings is incorrect.
I think the warning is just missing a `byte-compile-warning-enabled-p'
check:
--- i/lisp/emacs-lisp/bytecomp.el
+++ w/lisp/emacs-lisp/bytecomp.el
@@ -3128,7 +3128,8 @@ byte-compile-form
(when (assq var byte-compile-lexical-variables)
(byte-compile-report-error
(format-message "%s cannot use lexical var `%s'" fn var))))))
- (when (macroexp--const-symbol-p fn)
+ (when (and (byte-compile-warning-enabled-p 'suspicious)
+ (macroexp--const-symbol-p fn))
(byte-compile-warn "`%s' called as a function" fn))
(when (and (byte-compile-warning-enabled-p 'interactive-only)
interactive-only)
> In fact, it seems a little inconsistent to me that none of
>
> (defun :foo ())
>
> (byte-compile ':foo)
>
> (:foo)
>
> produces any warning, but compiling the call of :foo does produce a
> warning.
Maybe (byte-compile (lambda () (defun :foo ()))) should give a warning,
though I don't see why the others should.
This bug report was last modified 7 years and 76 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.