unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
       [not found] <E1SPYUf-00015v-FZ@vcs.savannah.gnu.org>
@ 2012-05-02 13:05 ` Michael Albinus
  2012-05-02 16:19   ` Juanma Barranquero
  2012-05-02 16:29   ` Juanma Barranquero
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Albinus @ 2012-05-02 13:05 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

Juanma Barranquero <lekktu@gmail.com> writes:

Hi Juanma,

> === modified file 'lisp/notifications.el'
> --- a/lisp/notifications.el	2012-04-24 21:47:24 +0000
> +++ b/lisp/notifications.el	2012-05-02 11:38:01 +0000
> @@ -344,6 +344,8 @@
>                      notifications-close-notification-method
>                      :int32 id))
>  
> +(defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors
> +
>  (defun notifications-get-capabilities ()
>    "Return the capabilities of the notification server, a list of strings.
>  The following capabilities can be expected:

Just for curiosity: why that? dbus-debug is declared in dbus.el, and
that package is required in notifications.el.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
  2012-05-02 13:05 ` /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings Michael Albinus
@ 2012-05-02 16:19   ` Juanma Barranquero
  2012-05-02 16:29   ` Juanma Barranquero
  1 sibling, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2012-05-02 16:19 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

> Just for curiosity: why that? dbus-debug is declared in dbus.el, and
> that package is required in notifications.el.

Without the defvar, it causes a warning on Windows:

In notifications-get-capabilities:
notifications.el:377:23:Warning: reference to free variable `dbus-debug'
Wrote c:/emacs/trunk/lisp/notifications.elc

    Juanma



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
  2012-05-02 13:05 ` /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings Michael Albinus
  2012-05-02 16:19   ` Juanma Barranquero
@ 2012-05-02 16:29   ` Juanma Barranquero
  2012-05-02 17:53     ` Michael Albinus
  1 sibling, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2012-05-02 16:29 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

On Wed, May 2, 2012 at 3:05 PM, Michael Albinus <michael.albinus@gmx.de> wrote:

> Just for curiosity: why that? dbus-debug is declared in dbus.el

It's declared, but not defined:

  ;; Declare used subroutines and variables.
  (declare-function dbus-message-internal "dbusbind.c")
  [...]
  (defvar dbus-debug)
  (defvar dbus-registered-objects-table)

An alternative fix would be to define it properly

 (defvar  dbus-debug nil "...")

which would clearly be the right thing if dbus-debug were part of
dbus.el's API. This is a corner case, because it is not advertised as
such, just used in a macroexpansion.

    Juanma



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
  2012-05-02 16:29   ` Juanma Barranquero
@ 2012-05-02 17:53     ` Michael Albinus
  2012-05-02 19:43       ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2012-05-02 17:53 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

Juanma Barranquero <lekktu@gmail.com> writes:

> On Wed, May 2, 2012 at 3:05 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
>
>> Just for curiosity: why that? dbus-debug is declared in dbus.el
>
> It's declared, but not defined:
>
>   ;; Declare used subroutines and variables.
>   (declare-function dbus-message-internal "dbusbind.c")
>   [...]
>   (defvar dbus-debug)
>   (defvar dbus-registered-objects-table)

I see. Thanks for the explanation.

> An alternative fix would be to define it properly
>
>  (defvar  dbus-debug nil "...")
>
> which would clearly be the right thing if dbus-debug were part of
> dbus.el's API. This is a corner case, because it is not advertised as
> such, just used in a macroexpansion.

`dbus-debug' is declared & defined un dbusbind.c, where it belongs
to. Your proposal would work, but it would be another dirty declaration
just in order to make the byte compiler silent.

The real solution would be to exclude notification.el (and other
packages) from byte compilation, if Emacs hasn't been compiled with
D-Bus support. Unfortunately, I don't know how to say this.

;; Local Variables:
;; no-byte-compile: (null (featurep 'dbusbind))
;; End: 

does not work, because the value for `no-byte-compile' is not evaluated.

;; Local Variables:
;; eval: (setq no-byte-compile (null (featurep 'dbusbind)))
;; End: 

doesn't work either.

>     Juanma

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
  2012-05-02 17:53     ` Michael Albinus
@ 2012-05-02 19:43       ` Juanma Barranquero
  2012-05-02 20:38         ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2012-05-02 19:43 UTC (permalink / raw)
  To: Michael Albinus; +Cc: emacs-devel

On Wed, May 2, 2012 at 7:53 PM, Michael Albinus <michael.albinus@gmx.de> wrote:

> `dbus-debug' is declared & defined un dbusbind.c, where it belongs to.

Aha. dbusbind.c is not compiled on Windows, obviously.

> The real solution would be to exclude notification.el (and other
> packages) from byte compilation, if Emacs hasn't been compiled with
> D-Bus support.

I don't think it's worth jumping through hoops just to silence a
warning, when a defvar will do.

    Juanma



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings.
  2012-05-02 19:43       ` Juanma Barranquero
@ 2012-05-02 20:38         ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2012-05-02 20:38 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

Juanma Barranquero <lekktu@gmail.com> writes:

>> The real solution would be to exclude notification.el (and other
>> packages) from byte compilation, if Emacs hasn't been compiled with
>> D-Bus support.
>
> I don't think it's worth jumping through hoops just to silence a
> warning, when a defvar will do.

Sure, we shouldn't change the byte compiler just because of this. But if
there would exist a mean to instruct the compiler, why not.

>     Juanma

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-02 20:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1SPYUf-00015v-FZ@vcs.savannah.gnu.org>
2012-05-02 13:05 ` /srv/bzr/emacs/trunk r108099: Silence byte-compiler warnings Michael Albinus
2012-05-02 16:19   ` Juanma Barranquero
2012-05-02 16:29   ` Juanma Barranquero
2012-05-02 17:53     ` Michael Albinus
2012-05-02 19:43       ` Juanma Barranquero
2012-05-02 20:38         ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).