GNU bug report logs - #36568
with-suppress-warnings not working in seq-tests.el

Previous Next

Package: emacs;

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

Date: Wed, 10 Jul 2019 03:24:02 UTC

Severity: minor

Fixed in version 29.1

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

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 36568 in the body.
You can then email your comments to 36568 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#36568; Package emacs. (Wed, 10 Jul 2019 03:24:02 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:24:02 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: with-suppress-warnings not working in seq-tests.el
Date: Wed, 10 Jul 2019 05:23:07 +0200
[Message part 1 (text/plain, inline)]
On current master, I'm seeing strange behaviour when trying to
suppress warnings in the test suite using with-suppressed-warnings.

(See also related bug Bug#36567 -- not sure if it's a duplicate.
Please merge if it is.)

Steps to reproduce:
0. Apply attached patch bug-suppressed-warnings.diff
1. Open shell
2. cd emacs/test
3. rm lisp/emacs-lisp/seq-tests.elc
4. make lisp/emacs-lisp/seq-tests

Result:
  ELC      lisp/emacs-lisp/seq-tests.elc

In toplevel form:
lisp/emacs-lisp/seq-tests.el:183:20:Warning: `seq-contains' is an obsolete
    function (as of 27.1); use `seq-contains-p' instead.
lisp/emacs-lisp/seq-tests.el:183:20:Warning: `seq-contains' is an obsolete
    function (as of 27.1); use `seq-contains-p' instead.
lisp/emacs-lisp/seq-tests.el:183:20:Warning: `seq-contains' is an obsolete
    function (as of 27.1); use `seq-contains-p' instead.
[...]

Expected result:
No such warnings appear.


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
[bug-suppressed-warnings.diff (application/octet-stream, attachment)]

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

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

From: Stefan Kangas <stefan <at> marxist.se>
To: 36568 <at> debbugs.gnu.org
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Wed, 10 Jul 2019 05:42:27 +0200
You could also use the patch in Bug#36565 to test this, I think.  That
is broken for what superficially looks like similar reasons.

Thanks,
Stefan Kangas




Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 15:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Sat, 22 Aug 2020 14:15:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36568 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Sat, 22 Aug 2020 16:14:09 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> On current master, I'm seeing strange behaviour when trying to
> suppress warnings in the test suite using with-suppressed-warnings.

[...]

> In toplevel form:
> lisp/emacs-lisp/seq-tests.el:183:20:Warning: `seq-contains' is an obsolete
>     function (as of 27.1); use `seq-contains-p' instead.

Odd.  To reproduce, I tried to just do:

(require 'seq)

(defun foo ()
  (with-suppressed-warnings ((obsolete seq-contains))
    (seq-contains '(3 4 5 6) 3)))

But the warning is suppressed correctly then.  So there's ... something
in the way the test files are compile that breaks
with-suppressed-warnings?  Something in the ert macros?  Anybody got any
ideas?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Wed, 07 Oct 2020 04:58:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36568 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Wed, 07 Oct 2020 06:57:03 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Odd.  To reproduce, I tried to just do:
>
> (require 'seq)
>
> (defun foo ()
>   (with-suppressed-warnings ((obsolete seq-contains))
>     (seq-contains '(3 4 5 6) 3)))
>
> But the warning is suppressed correctly then.  So there's ... something
> in the way the test files are compile that breaks
> with-suppressed-warnings?  Something in the ert macros?  Anybody got any
> ideas?

I poked around a bit more, and wondered whether the suppression would
survive if I pushed it as close to the function as possible:

(ert-deftest test-seq-contains-should-return-the-elt ()
  (should (= 5 (with-suppressed-warnings ((obsolete seq-contains))
                 (seq-contains '(1 2 3 4 5) 5)))))

But this leads to:

Debugger entered--Lisp error: (void-function internal--with-suppressed-warnings)
  signal(void-function (internal--with-suppressed-warnings))
  apply(signal (void-function (internal--with-suppressed-warnings)))
  (setq value-2846 (apply fn-2844 args-2845))
  (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc (list '(should (= 5 (with-suppressed-warnings ... ...)))) (list :form (cons fn-2844 args-2845)) (if (eql value-2846 'ert-form-evaluation-aborted-2847) nil (list :value value-2846)) (let ((-explainer- (and (symbolp ...) (get ... ...)))) (if -explainer- (progn (list :explanation (apply -explainer- args-2845))))))) (ert--signal-should-execution form-description-2848))
  (if (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc (list '(should (= 5 ...))) (list :form (cons fn-2844 args-2845)) (if (eql value-2846 'ert-form-evaluation-aborted-2847) nil (list :value value-2846)) (let ((-explainer- (and ... ...))) (if -explainer- (progn (list :explanation ...)))))) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848))
  (let (form-description-2848) (if (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc (list '(should ...)) (list :form (cons fn-2844 args-2845)) (if (eql value-2846 'ert-form-evaluation-aborted-2847) nil (list :value value-2846)) (let ((-explainer- ...)) (if -explainer- (progn ...))))) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848)))
  (let ((value-2846 'ert-form-evaluation-aborted-2847)) (let (form-description-2848) (if (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc (list '...) (list :form (cons fn-2844 args-2845)) (if (eql value-2846 ...) nil (list :value value-2846)) (let (...) (if -explainer- ...)))) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848))) value-2846)
  (let* ((fn-2844 #'=) (args-2845 (condition-case err (let ((signal-hook-function #'ert--should-signal-hook)) (list 5 (internal--with-suppressed-warnings '... (progn ...)))) (error (progn (setq fn-2844 #'signal) (list (car err) (cdr err))))))) (let ((value-2846 'ert-form-evaluation-aborted-2847)) (let (form-description-2848) (if (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc (list ...) (list :form ...) (if ... nil ...) (let ... ...))) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848))) value-2846))
  (progn (let* ((fn-2844 #'=) (args-2845 (condition-case err (let ((signal-hook-function ...)) (list 5 (internal--with-suppressed-warnings ... ...))) (error (progn (setq fn-2844 ...) (list ... ...)))))) (let ((value-2846 'ert-form-evaluation-aborted-2847)) (let (form-description-2848) (if (unwind-protect (setq value-2846 (apply fn-2844 args-2845)) (setq form-description-2848 (nconc ... ... ... ...)) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848))) value-2846)))
  eval((progn (let* ((fn-2844 #'=) (args-2845 (condition-case err (let (...) (list 5 ...)) (error (progn ... ...))))) (let ((value-2846 'ert-form-evaluation-aborted-2847)) (let (form-description-2848) (if (unwind-protect (setq value-2846 ...) (setq form-description-2848 ...) (ert--signal-should-execution form-description-2848)) nil (ert-fail form-description-2848))) value-2846))) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)


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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Wed, 07 Oct 2020 05:19:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36568 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Wed, 07 Oct 2020 07:18:42 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Debugger entered--Lisp error: (void-function internal--with-suppressed-warnings)
>   signal(void-function (internal--with-suppressed-warnings))
>   apply(signal (void-function (internal--with-suppressed-warnings)))

Ah, this is due to

(defvar byte-compile-initial-macro-environment
...
    (with-suppressed-warnings
        . ,(lambda (warnings &rest body)
             ;; We let-bind `byte-compile--suppressed-warnings' here in order
             ;; to affect warnings emitted during macroexpansion.
             ;; Later `internal--with-suppressed-warnings' binds it again, this
             ;; time in order to affect warnings emitted during the
             ;; compilation itself.
             (let ((byte-compile--suppressed-warnings
                    (append warnings byte-compile--suppressed-warnings)))
               ;; This function doesn't exist, but is just a placeholder
               ;; symbol to hook up with the
               ;; `byte-hunk-handler'/`byte-defop-compiler-1' machinery.
               `(internal--with-suppressed-warnings
                 ',warnings
                 ,(macroexpand-all `(progn ,@body)
                                   macroexpand-all-environment))))))


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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Wed, 07 Oct 2020 05:36:02 GMT) Full text and rfc822 format available.

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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, 36568 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Wed, 07 Oct 2020 07:35:06 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > Debugger entered--Lisp error: (void-function internal--with-suppressed-warnings)
> >   signal(void-function (internal--with-suppressed-warnings))
> >   apply(signal (void-function (internal--with-suppressed-warnings)))
>
> Ah, this is due to
>
> (defvar byte-compile-initial-macro-environment

Yes, I have found `ert--expand-should-1' where the macroexpansion is
performed and came to the same conclusion.  This function already has a
FIXME on its top ;-)

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Sun, 05 Dec 2021 03:23:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36568 <at> debbugs.gnu.org
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Sun, 05 Dec 2021 04:22:01 +0100
Stefan Kangas <stefan <at> marxist.se> writes:

> On current master, I'm seeing strange behaviour when trying to
> suppress warnings in the test suite using with-suppressed-warnings.
>
> (See also related bug Bug#36567 -- not sure if it's a duplicate.
> Please merge if it is.)
>
> Steps to reproduce:
> 0. Apply attached patch bug-suppressed-warnings.diff
> 1. Open shell
> 2. cd emacs/test
> 3. rm lisp/emacs-lisp/seq-tests.elc
> 4. make lisp/emacs-lisp/seq-tests
>
> Result:
>   ELC      lisp/emacs-lisp/seq-tests.elc
>
> In toplevel form:
> lisp/emacs-lisp/seq-tests.el:183:20:Warning: `seq-contains' is an obsolete
>     function (as of 27.1); use `seq-contains-p' instead.

Looks like this has been fixed (perhaps by that recent change to
macroexp/warning suppression?)  So I've now removed the workaround from
seq-tests.el, and I'm not seeing any warnings, and I'm therefore closing
this bug report.

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




bug marked as fixed in version 29.1, send any further explanations to 36568 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 05 Dec 2021 03:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36568; Package emacs. (Sun, 05 Dec 2021 11:28:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 36568 <at> debbugs.gnu.org
Subject: Re: bug#36568: with-suppress-warnings not working in seq-tests.el
Date: Sun, 5 Dec 2021 12:27:11 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Looks like this has been fixed (perhaps by that recent change to
> macroexp/warning suppression?)  So I've now removed the workaround from
> seq-tests.el, and I'm not seeing any warnings, and I'm therefore closing
> this bug report.

Aha, that's good.  I removed two similar hacks, and the warnings are
indeed gone in those cases as well.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Jan 2022 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 183 days ago.

Previous Next


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