Disable "make all warnings errors"

I have a dune project that is behaving as if I have gcc -Wall -Werr (i.e. turn all warnings into errors).

I want to disable this behavior. The reason is: why I’m writing new code / refactoring code, I do want to be notified of errors (i.e. type mismatch here) but currently, I’m getting spam cluttered by warnings (unused Open, unused let , …).

Is there a way to make all warnings behave like warnings and not errors ?


1 Like

Simplest way is adding --profile release when doing dune whatever.

Link to dune docs.

1 Like

-warn-error -A, I think
Studying compiler switches usually helps.

Caveat: if you use the release profile, then tests won’t be run.
An alternative, where warnings are non-fatal and tests can be run, is to add the following stanza to your dune-workspace file: (env (dev (flags (:standard -warn-error -A)))).

Not strictly related to this topic, but since I can’t reply to the other ones -
Can you please stop deleting your posts?
We can still see the messages, so it’s adding noise for every user of this forum.


That’s interesting…how are you setting up your tests?

E.g., I use inline tests and they definitely run even in profile release (but without warnings as errors). But of course, perhaps that is actually just a quirk of inline tests.

I believe deleted posts vanish after 24 hours. If I post a problem, no one responds, and I resolve it, what is the preferred action ?

It would be valuable to write even a short summary of how you solved the problem. I imagine if you had a question about something, someone else has at some point too.

1 Like

I read this there :

(inline_tests <state>), where <state> is either enabled, disabled, or ignored. This field has been available since Dune 1.11. It controls the variable’s value %{inline_tests}, which is read by the inline test framework. The default value is disabled for the release profile and enabled otherwise.

I haven’t checked recently if this has changed (and then the doc must be out of date), but this was still working this way last year.

EDIT: see also this post and subsequent messages that, for some, confirm this issue.

Huh, that’s interesting…could be new behavior I suppose. They do work in release mode now (at least with my setup)…I will take a look at this later and see if the docs are out of date.

If I post a problem, no one responds, and I resolve it, what is the preferred action ?

I would suggest trying the following two techniques:

  • in the case where you found the solution to your question, please put it as an answer. other people might have the same question.
  • most importantly, please try to solve your issue first before posting about it. if you found a solution, you don’t even need to post in the first place.