Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug#4837: with-fewer-warnings ?

0 views
Skip to first unread message

Glenn Morris

unread,
Oct 30, 2009, 10:25:36 PM10/30/09
to bug-gn...@gnu.org
Severity: wishlist

`with-no-warnings' suppresses all compilation warnings.

I would like to add `with-fewer-warnings' (or some similar name) that
suppresses only some warnings.

Eg (with-fewer-warnings '(obsolete cl-functions) ...)

would not warn about obsolete things or cl-functions in the body. The
possible arguments are the members of byte-compile-warnings.

I can implement this if it is considered worth it (it's very similar
to with-no-warnings).


Eli Zaretskii

unread,
Oct 31, 2009, 4:49:00 AM10/31/09
to Glenn Morris, 48...@emacsbugs.donarmstrong.com
> From: Glenn Morris <r...@gnu.org>
> Date: Fri, 30 Oct 2009 22:25:36 -0400
> Cc:
>
> Eg (with-fewer-warnings '(obsolete cl-functions) ...)
>
> would not warn about obsolete things or cl-functions in the body. The
> possible arguments are the members of byte-compile-warnings.

with-suppressed-warnings sounds like a better name to me.

Richard Stallman

unread,
Oct 31, 2009, 10:31:19 PM10/31/09
to Glenn Morris, 48...@emacsbugs.donarmstrong.com, bug-gn...@gnu.org
Eg (with-fewer-warnings '(obsolete cl-functions) ...)

would not warn about obsolete things or cl-functions in the body. The
possible arguments are the members of byte-compile-warnings.

I can implement this if it is considered worth it (it's very similar
to with-no-warnings).

I think it isn't worth doing, because it would only gain you very much
if you put a lot of code inside with-no-warnings; we avoid doing that.

Richard Stallman

unread,
Oct 31, 2009, 10:31:19 PM10/31/09
to Glenn Morris, 48...@emacsbugs.donarmstrong.com, bug-gn...@gnu.org

Glenn Morris

unread,
Nov 9, 2009, 3:45:24 AM11/9/09
to r...@gnu.org, 48...@emacsbugs.donarmstrong.com
Richard Stallman wrote:

> I think it isn't worth doing,

(I'd already done it, locally, before posting.)

> because it would only gain you very much if you put a lot of code
> inside with-no-warnings; we avoid doing that.

Perhaps because it is such a blunt instrument. This would make it a
bit less blunt. I don't claim this is important, but it is easy to
implement.

Example usage:

In the _implementation_ of an obsolete feature, it's ok to use an
obsolete variable and there is no need to be warned about it being
obsolete. However, you should still be warned about the variable not
being defined, in case you remove it altogether but forget to update
the code that uses it.


Stefan Monnier

unread,
Nov 9, 2009, 9:38:45 AM11/9/09
to Glenn Morris, 48...@emacsbugs.donarmstrong.com, r...@gnu.org
>> I think it isn't worth doing,
> (I'd already done it, locally, before posting.)
>> because it would only gain you very much if you put a lot of code
>> inside with-no-warnings; we avoid doing that.

> Perhaps because it is such a blunt instrument. This would make it a
> bit less blunt. I don't claim this is important, but it is easy to
> implement.

> In the _implementation_ of an obsolete feature, it's ok to use an


> obsolete variable and there is no need to be warned about it being
> obsolete. However, you should still be warned about the variable not
> being defined, in case you remove it altogether but forget to update
> the code that uses it.

Actually, I think I agree (I hate with-no-warnings), but it should be
even more precise, and specify which obsolete warning to silence.


Stefan

Glenn Morris

unread,
Nov 9, 2009, 9:09:43 PM11/9/09
to Stefan Monnier, 48...@emacsbugs.donarmstrong.com, r...@gnu.org
Stefan Monnier wrote:

> Actually, I think I agree (I hate with-no-warnings), but it should be
> even more precise, and specify which obsolete warning to silence.

Do you mean, specify precisely which obsolete variable/function(s) not
to warn about? That's probably doable via
byte-compile-not-obsolete-vars/funcs, I'll have a look.

A syntax like this?

(with-suppressed-warnings
'((obsolete read-file-name-predicate ...) cl-functions ...)
body)

Although the motivation for this was not _just_ obsolete warnings, and
it might not be so simple to extend your request to eg specific free
variables.

Stefan Monnier

unread,
Nov 10, 2009, 12:58:06 PM11/10/09
to Glenn Morris, 48...@emacsbugs.donarmstrong.com, r...@gnu.org
>> Actually, I think I agree (I hate with-no-warnings), but it should be
>> even more precise, and specify which obsolete warning to silence.

> Do you mean, specify precisely which obsolete variable/function(s) not
> to warn about? That's probably doable via
> byte-compile-not-obsolete-vars/funcs, I'll have a look.

> A syntax like this?

> (with-suppressed-warnings
> '((obsolete read-file-name-predicate ...) cl-functions ...)
> body)

Yes, something like that. Also the `cl-functions' is too broad and
should not be allowed.

> Although the motivation for this was not _just_ obsolete warnings, and
> it might not be so simple to extend your request to eg specific free
> variables.

I didn't say it was easy.

BTW, maybe a good way to do it is to implement this in the function
that outputs the warnings: currently it just received some kind of
string, which is not very amenable to what we want, but if you change it
to take a more structured description of the warning, then it might be
doable (tho maybe it won't happen at the right place, I don't know).


Stefan

Lars Ingebrigtsen

unread,
Jun 13, 2019, 10:09:33 AM6/13/19
to Glenn Morris, 48...@debbugs.gnu.org
Glenn Morris <r...@gnu.org> writes:

> `with-no-warnings' suppresses all compilation warnings.
>
> I would like to add `with-fewer-warnings' (or some similar name) that
> suppresses only some warnings.
>
> Eg (with-fewer-warnings '(obsolete cl-functions) ...)

This is now implemented on master as `with-suppressed-warnings'.

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



Glenn Morris

unread,
Jun 13, 2019, 10:09:38 AM6/13/19
to Lars Ingebrigtsen, 48...@debbugs.gnu.org
Lars Ingebrigtsen wrote:

> This is now implemented on master as `with-suppressed-warnings'.

Thanks a lot! :)



0 new messages