[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Towards a cleaner build
From: |
Lars Ingebrigtsen |
Subject: |
Re: Towards a cleaner build |
Date: |
Wed, 29 May 2019 13:17:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Noam Postavsky <address@hidden> writes:
> On Tue, 28 May 2019 at 11:11, Lars Ingebrigtsen <address@hidden> wrote:
>
>> +(defmacro with-suppressed-warnings (warnings &rest body)
>> + "Like `progn', but prevents compiler warnings in the body."
>
> Not quite like progn, since WARNINGS (is that WARNINGS or WARNING, by
> the way?) is not evaluated.
>
>> + (declare (indent 1))
>
> A debug spec would be a good thing to have.
Yup.
>> + ;; The implementation for the interpreter is basically trivial.
>> + `(with-suppressed-warnings-1 ',warnings (progn ,@body)))
>
> A comment here on why we need both a function and macro would be
> useful (or is it possible to have this work with just a macro?)
Let's see... Oh, right. `with-no-warnings' is a function, while I
thought it would make sense for `with-suppressed-warnings' to be a macro
since the WARNINGS are supposed to be unevaluated.
But as a macro that expands to (basically) `progn', then the byte
compiler just sees the `progn' and is unable to do anything with the
form. So I needed to make the macro expand to something the byte
compiler can pick up, which is `with-suppressed-warnings-1'.
I'm completely open to me not understanding how the byte compiler
works... because I don't, really. :-) But I tried using just a macro
first, and I couldn't get the byte compiler to understand it.
>> +(defun with-suppressed-warnings-1 (_ &rest body)
>> + "Like `progn', but prevents compiler warnings in the body."
>> + (declare (indent 1))
>
> This should be called internal--with-suppressed-warnings-1, and the
> (declare (indent 1)) thing left out, since nobody should be calling
> this function directly anyway, right?
Yup.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Towards a cleaner build, (continued)
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/28
- Re: Towards a cleaner build, Noam Postavsky, 2019/05/28
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/28
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/28
- Re: Towards a cleaner build, Eli Zaretskii, 2019/05/28
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/28
- Re: Towards a cleaner build, Eli Zaretskii, 2019/05/28
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/29
- Re: Towards a cleaner build, Noam Postavsky, 2019/05/28
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/28
- Re: Towards a cleaner build,
Lars Ingebrigtsen <=
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/29
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/29
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/28
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/17
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/18
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/18
- Re: Towards a cleaner build, Lars Ingebrigtsen, 2019/05/18
- Re: Towards a cleaner build, Eli Zaretskii, 2019/05/17
- Re: Towards a cleaner build, Stefan Monnier, 2019/05/17
RE: Towards a cleaner build, Drew Adams, 2019/05/16