caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] enabling warnings using compiler-libs
@ 2017-05-29 21:59 Josh Berdine
  2017-05-29 22:18 ` Nicolás Ojeda Bär
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Berdine @ 2017-05-29 21:59 UTC (permalink / raw)
  To: caml-list

I would like to call e.g. Parse.implementation from compiler-libs with warning 50 'Bad_docstring' enabled.  Have I overlooked something, or is that not possible using the standard exposed interface?

I guess that one warning that involves the parser might not justify the overhead of adding an interface?

Cheers, Josh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] enabling warnings using compiler-libs
  2017-05-29 21:59 [Caml-list] enabling warnings using compiler-libs Josh Berdine
@ 2017-05-29 22:18 ` Nicolás Ojeda Bär
  2017-05-29 23:17   ` Josh Berdine
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolás Ojeda Bär @ 2017-05-29 22:18 UTC (permalink / raw)
  To: Josh Berdine; +Cc: OCaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 981 bytes --]

Hi Josh,

I think you can use

  Warnings.parse_options : bool -> string -> unit

for that.  The first flag indicates if the warning should be an error and
the second argument specifies the warnings in the usual format.  For
example,

  Warnings.parse_options true "+50"

would activate Warning 50 as an error, etc.

Best wishes,
Nicolas


On Mon, May 29, 2017 at 11:59 PM, Josh Berdine <josh@berdine.net> wrote:

> I would like to call e.g. Parse.implementation from compiler-libs with
> warning 50 'Bad_docstring' enabled.  Have I overlooked something, or is
> that not possible using the standard exposed interface?
>
> I guess that one warning that involves the parser might not justify the
> overhead of adding an interface?
>
> Cheers, Josh
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 1841 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] enabling warnings using compiler-libs
  2017-05-29 22:18 ` Nicolás Ojeda Bär
@ 2017-05-29 23:17   ` Josh Berdine
  0 siblings, 0 replies; 3+ messages in thread
From: Josh Berdine @ 2017-05-29 23:17 UTC (permalink / raw)
  To: OCaml Mailing List

Hi Nicolas,

>   Warnings.parse_options true "+50"
>
> would activate Warning 50 as an error, etc.

I see, thanks, that's helpful.  I was trusting the documentation (that does not mention Warnings) too much it seems.

Curiously, it only works with

    Warnings.parse_options false "+50"

but not

    Warnings.parse_options true "+50"

because the code in Docstrings.warn_bad_docstrings only checks Warnings.is_active but not Warnings.is_error.  But

    Warnings.parse_options false "@50"

followed later by

    Warnings.check_fatal ()

does both print the warning and raise Warnings.Errors.

Cheers, Josh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-29 23:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29 21:59 [Caml-list] enabling warnings using compiler-libs Josh Berdine
2017-05-29 22:18 ` Nicolás Ojeda Bär
2017-05-29 23:17   ` Josh Berdine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).