bug#4837: with-fewer-warnings ?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Glenn Morris-3
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).




Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Eli Zaretskii
> From: Glenn Morris <[hidden email]>
> 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.



Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Richard Stallman
In reply to this post by Glenn Morris-3
    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.





Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Glenn Morris-3
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.




Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Stefan Monnier
>> 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



Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Glenn Morris-3
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.



Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Stefan Monnier
>> 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



Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Lars Ingebrigtsen
In reply to this post by Glenn Morris-3
Glenn Morris <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

bug#4837: with-fewer-warnings ?

Glenn Morris-3
Lars Ingebrigtsen wrote:

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

Thanks a lot! :)