Lisp HUG Maillist Archive

Generate custom compiler warning

Hi all,

Is where a way to declare custom compile-time warning?
Something similar to C++ #pragma message or GCC #warning
So it could be visible in Compilation Conditions Browser.

I'm planning to use it to to issue warning about FIXME or TODO stuff I've added as a temporary code.

Br
/Alexey

Re: Generate custom compiler warning

Hello Alexey,

| Is where a way to declare custom compile-time warning?
| Something similar to C++ #pragma message or GCC #warning
| So it could be visible in Compilation Conditions Browser.
| 
| I'm planning to use it to to issue warning about FIXME or TODO stuff
| I've added as a temporary code.

I believe something like this:
#+FIXME
(eval-when (:compile-toplevel)
  (warn ...))
--
Sincerely,
Dmitry Ivanov
lisp.ystok.ru

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: Generate custom compiler warning

Unable to parse email body. Email id is 14112

Re: Generate custom compiler warning

Thanks! This works for me perfectly!

Br,
/Alexey

On Tue, Nov 29, 2016 at 12:51 PM, Martin Simmons <martin@lispworks.com> wrote:

>>>>> On Tue, 29 Nov 2016 10:40:15 +0100, Alexey Veretennikov said:
>
> Is where a way to declare custom compile-time warning?
> Something similar to C++ #pragma message or GCC #warning
> So it could be visible in Compilation Conditions Browser.
>
> I'm planning to use it to to issue warning about FIXME or TODO stuff I've
> added as a temporary code.

For warnings inside a function, you could call WARN during macroexpansion (it
returns nil):

(defmacro compiler-warning (datum &rest arguments)
  (apply 'warn datum arguments))

The macroexpansion might occur more than once though.

--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:31 UTC