bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24863: Functions declared as side-effect-free do not generate warnin


From: npostavs
Subject: bug#24863: Functions declared as side-effect-free do not generate warnings in the same file
Date: Thu, 03 Nov 2016 19:14:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

severity 24863 minor
quit

Wilfred Hughes <me@wilfred.me.uk> writes:

>
> However, ideally this wouldn't be required. I think it's just a matter
> of changing defun-declarations-alist to:
>
>    (list 'side-effect-free
>          #'(lambda (f _args val)
>              `(eval-and-compile (function-put ',f 'side-effect-free ',val)))
>          "If non-nil, calls can be ignored if their value is unused.
> If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")

Note the comment above:

   ;; We can only use backquotes inside the lambdas and not for those
   ;; properties that are used by functions loaded before backquote.el.

Since the side-effect-free lambda wasn't using backquotes, I presume it
has to stay that way.

On StackExchange you commented

    changing defun-declarations-alist in my current Emacs instance
    doesn't fix the issue

But doing

    (setf (nth 1 (assq 'side-effect-free defun-declarations-alist))
          (lambda (f _args val)
            `(eval-and-compile (function-put ',f 'side-effect-free ',val))))

in a running Emacs works for me.  By "changing" did you mean just
changing the source?  In that case, you would have to redump Emacs
before the change would take effect.





reply via email to

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