caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] how to apply an attribute on ppx output
@ 2015-11-24 18:52 Ashish Agarwal
  2015-11-24 19:02 ` Leo White
  0 siblings, 1 reply; 5+ messages in thread
From: Ashish Agarwal @ 2015-11-24 18:52 UTC (permalink / raw)
  To: Caml List

[-- 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 --]

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

end of thread, other threads:[~2015-11-25 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 18:52 [Caml-list] how to apply an attribute on ppx output Ashish Agarwal
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

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).