GNU bug report logs - #36567
cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Wed, 10 Jul 2019 03:12:01 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36567 in the body.
You can then email your comments to 36567 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36567; Package emacs. (Wed, 10 Jul 2019 03:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 10 Jul 2019 03:12:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
Date: Wed, 10 Jul 2019 05:11:01 +0200
cl-defgeneric defeats with-suppressed-warnings on current
master under certain circumstances.

Steps to reproduce:
0. emacs -Q
1. C-x C-f foo.el RET
2. Insert into buffer:

(require 'cl-generic)
(cl-defgeneric foo ()
  (declare (obsolete nil nil))
  t)

3. C-x C-e    [i.e. evaluate foo]
4. Insert into buffer:

(with-suppressed-warnings ((obsolete foo))
  (foo))

5. C-x C-s
6. M-x byte-compile-file RET foo.el RET

Result:
*Compile-Log* buffer contains:
foo.el:3:22:Warning: ‘foo’ is an obsolete generic function.

Expected result:
*Compile-Log* buffer contains no warning.


In GNU Emacs 27.0.50 (build 2, x86_64-apple-darwin15.6.0, NS
appkit-1404.47 Version 10.11.6 (Build 15G22010))
 of 2019-07-10 built on Stefans-MBP
Repository revision: 77cf71ce8cc611ecfd143277441e2ad4acc9401b
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1404
System Description:  Mac OS X 10.11.6




Added tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 10 Jul 2019 12:12:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36567; Package emacs. (Wed, 10 Jul 2019 12:16:01 GMT) Full text and rfc822 format available.

Message #10 received at 36567 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36567 <at> debbugs.gnu.org
Subject: Re: bug#36567: cl-defgeneric defeats (with-suppressed-warnings
 ((obsolete fun)) ...)
Date: Wed, 10 Jul 2019 14:15:17 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Result:
> *Compile-Log* buffer contains:
> foo.el:3:22:Warning: ‘foo’ is an obsolete generic function.

Gah.  I thought we had squished all these by now...

So the thing is that if you have already eval-ed an obsolete defgeneric,
and then you compile a file that contains suppressed use of it, then you
still get the warning?

Hmm...

Oh!  No, it's warning about the defgeneric itself?  Compiling this leads
to a warning (if it's already defined):

(require 'cl-generic)
(cl-defgeneric foo ()
  (declare (obsolete nil nil))
  t)

Compiling this doesn't:

(require 'cl-generic)
(with-suppressed-warnings ((obsolete foo))
  (cl-defgeneric foo ()
    (declare (obsolete nil nil))
    t))

So...  I think...  perhaps this is not a bug?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Removed tag(s) confirmed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 10 Jul 2019 12:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36567; Package emacs. (Wed, 10 Jul 2019 23:02:02 GMT) Full text and rfc822 format available.

Message #15 received at 36567 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 36567 <at> debbugs.gnu.org
Subject: Re: bug#36567: cl-defgeneric defeats (with-suppressed-warnings
 ((obsolete fun)) ...)
Date: Thu, 11 Jul 2019 01:01:19 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Oh!  No, it's warning about the defgeneric itself?  Compiling this leads
> to a warning (if it's already defined):
>
> (require 'cl-generic)
> (cl-defgeneric foo ()
>   (declare (obsolete nil nil))
>   t)
>
> Compiling this doesn't:
>
> (require 'cl-generic)
> (with-suppressed-warnings ((obsolete foo))
>   (cl-defgeneric foo ()
>     (declare (obsolete nil nil))
>     t))
>
> So...  I think...  perhaps this is not a bug?

Interesting.  It looks like there is indeed no bug in
with-suppressed-warnings.

Is it also expected that the cl-defgeneric in the first case gives a
warning?  I don't get a warning if I replace "cl-defgeneric" with
"defun" in that case.  I would expect only usage of an obsolete
cl-defgeneric to give a warning, not its definition.  My expectations
may be wrong.

Thanks,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36567; Package emacs. (Thu, 11 Jul 2019 14:15:02 GMT) Full text and rfc822 format available.

Message #18 received at 36567 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36567 <at> debbugs.gnu.org
Subject: Re: bug#36567: cl-defgeneric defeats (with-suppressed-warnings
 ((obsolete fun)) ...)
Date: Thu, 11 Jul 2019 16:14:34 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> Is it also expected that the cl-defgeneric in the first case gives a
> warning?  I don't get a warning if I replace "cl-defgeneric" with
> "defun" in that case.  I would expect only usage of an obsolete
> cl-defgeneric to give a warning, not its definition.  My expectations
> may be wrong.

The defgeneric machinery has its own separate warning system outside of
the byte compiler which is why things are slightly odd in this area.

But currently, both cl-defgeneric and cl-defmethod warn if you try to
an obsolete method.  I think that makes sense for cl-defmethod (because
it's a "use", sort of, of an obsolete method), but perhaps it does not
make sense for cl-defgeneric?

As for defun -- if you've made a function obsolete, and then defun it, I
think not giving a warning is conceptually sound, because you're
defining something brand new.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36567; Package emacs. (Sat, 13 Jul 2019 09:21:02 GMT) Full text and rfc822 format available.

Message #21 received at 36567 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 36567 <at> debbugs.gnu.org
Subject: Re: bug#36567: cl-defgeneric defeats (with-suppressed-warnings
 ((obsolete fun)) ...)
Date: Sat, 13 Jul 2019 11:19:44 +0200
tags 36567 + notabug
close 36567
thanks

Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> But currently, both cl-defgeneric and cl-defmethod warn if you try to
> an obsolete method.  I think that makes sense for cl-defmethod (because
> it's a "use", sort of, of an obsolete method), but perhaps it does not
> make sense for cl-defgeneric?

I'd be interested to know.

But for now, I'm closing this bug report, since that seems to be a separate
issue from the original one.  If anyone wants to, they can always submit a new
bug report for the above if it is indeed an issue.

Thanks for taking the time to investigate this.

Best regards,
Stefan Kangas




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 09:21:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 36567 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 09:21:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 10 Aug 2019 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 260 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.