[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30499: 26.0.91; Compiler warning cannot be suppressed

From: Noam Postavsky
Subject: bug#30499: 26.0.91; Compiler warning cannot be suppressed
Date: Tue, 06 Mar 2018 09:06:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

found 30499 24.3

Francis Wright <address@hidden> 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

> 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'

--- 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)
                 (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)

> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]