unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
@ 2019-07-10  3:11 Stefan Kangas
  2019-07-10 12:15 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-07-10  3:11 UTC (permalink / raw)
  To: 36567

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





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

* bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
  2019-07-10  3:11 bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...) Stefan Kangas
@ 2019-07-10 12:15 ` Lars Ingebrigtsen
  2019-07-10 23:01   ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-10 12:15 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36567

Stefan Kangas <stefan@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





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

* bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
  2019-07-10 12:15 ` Lars Ingebrigtsen
@ 2019-07-10 23:01   ` Stefan Kangas
  2019-07-11 14:14     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-07-10 23:01 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 36567

Lars Ingebrigtsen <larsi@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





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

* bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
  2019-07-10 23:01   ` Stefan Kangas
@ 2019-07-11 14:14     ` Lars Ingebrigtsen
  2019-07-13  9:19       ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-11 14:14 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36567

Stefan Kangas <stefan@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





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

* bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...)
  2019-07-11 14:14     ` Lars Ingebrigtsen
@ 2019-07-13  9:19       ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-07-13  9:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 36567

tags 36567 + notabug
close 36567
thanks

Lars Ingebrigtsen <larsi@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





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

end of thread, other threads:[~2019-07-13  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10  3:11 bug#36567: cl-defgeneric defeats (with-suppressed-warnings ((obsolete fun)) ...) Stefan Kangas
2019-07-10 12:15 ` Lars Ingebrigtsen
2019-07-10 23:01   ` Stefan Kangas
2019-07-11 14:14     ` Lars Ingebrigtsen
2019-07-13  9:19       ` Stefan Kangas

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