From: Ashish Agarwal <agarwal1975@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] how to apply an attribute on ppx output
Date: Tue, 24 Nov 2015 13:52:59 -0500 [thread overview]
Message-ID: <CAMu2m2K8ZUDDy0cyfgMHasLMMnbTqpj48y3DrexEZ-ERFnhxLw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1999 bytes --]
$ cat foo.mli
type t
$ cat foo.ml
type t = {a:int} [@@deriving fields]
$ ocamlfind ocamlc -package ppx_fields_conv,fieldslib -w A -c foo.mli
$ ocamlfind ocamlc -package ppx_fields_conv,fieldslib -w A -c foo.ml
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value names.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value make_creator.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value create.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value map.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value iter.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value fold.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value map_poly.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value for_all.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value exists.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value to_list.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value iter.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value fold.
File "foo.ml", line 1, characters 5-6:
Warning 32: unused value set_all_mutable_fields.
Thus, I'd like to disable warning 32, but only for the items generated by
the ppx extension. I've tried adding [@@warning "-32"] in various places
but it understandably doesn't work. So then I tried defining an internal
module and disabling in the entire module like this:
$ cat foo.ml
module T = struct
[@@warning "-32"]
type t = {a:int} [@@deriving fields]
end
include T
However I get a syntax error, even though this follows the example of the
manual in section 7.221
<http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec242>. Is this a
bug in the manual? According to the grammar it seems the attribute should
be added after the module expression:
$ cat foo.ml
module T = struct
type t = {a:int} [@@deriving fields]
end [@@warning "-32"]
include T
This compiles, but the warnings don't go away. Is there a solution?
[-- Attachment #2: Type: text/html, Size: 3332 bytes --]
next reply other threads:[~2015-11-24 18:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 18:52 Ashish Agarwal [this message]
2015-11-24 19:02 ` Leo White
2015-11-24 19:25 ` octachron
2015-11-24 21:17 ` Ashish Agarwal
2015-11-25 11:33 ` Jeremie Dimino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMu2m2K8ZUDDy0cyfgMHasLMMnbTqpj48y3DrexEZ-ERFnhxLw@mail.gmail.com \
--to=agarwal1975@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox