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

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

bug#58865: 29.0.50; Warnings when compiling net/dbus.el


From: Stefan Monnier
Subject: bug#58865: 29.0.50; Warnings when compiling net/dbus.el
Date: Mon, 31 Oct 2022 16:33:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> However, dbus.el is prepared to care this situation. It contains the code
>
> --8<---------------cut here---------------start------------->8---
> ;; The following symbols are defined in dbusbind.c.  We need them also
> ;; when Emacs is compiled without D-Bus support.
> (unless (boundp 'dbus-error)
>   (define-error 'dbus-error "D-Bus error"))
>
> (unless (boundp 'dbus-debug)
>   (defvar dbus-debug nil))
> --8<---------------cut here---------------end--------------->8---

Hmm... this will define `dbus-debug` as a dynamically scoped variable
when `dbus.el(c)` is *loaded* but not while compiling this file, so the
compilation *should* arguably emit those warnings (and those relating
the the places where we let-bind this var reflect real bugs because
we'll miscompile those bindings as if they were using static scoping).

So I think the code requires a top-level (defvar dbus-debug).

> This has worked fine until recently. According to git bisect, the
> following commit has broken this:
>
> --8<---------------cut here---------------start------------->8---
> 1b1ffe07897ebe06cf96ab423fad3cde9fd6c981 is the first bad commit

I wonder why we didn't get warnings before that commit (and why this
commit makes a difference).

...

Oh, I see.  The patch changed a bit how dynvars are recognized which
fixed some cases where `defvar`s "leaked" outside of their context.

The previous leak, in the present case, caused the `(defvar dbus-debug
nil)` to mark that var as dyn-bound in the whole file rather than only
within the `unless` where it appears.
Admittedly, in this case it was the right call :-)


        Stefan






reply via email to

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