From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9F6D97EEFC for ; Tue, 17 Nov 2015 13:12:00 +0100 (CET) IronPort-PHdr: 9a23:T4gQjR3BF6bsxA4psmDT+DRfVm0co7zxezQtwd8ZsekWK/ad9pjvdHbS+e9qxAeQG96LtrQZ2qGN6OjJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6PyZnmnLvps7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYjck87NZNWrnWeKExTLoQTGh3cjN92Mq+kBDfQAnHxXwHU2ZexkcXXVTOtEurVMmh4iCjvbJxgnWTZ8CnErs4Bmr+4Y9kTRbpjGEMMDtvo0/Njcklo6tRuhOso1REyI7ZeoyPfK5xd6nHfN4eA3FKXstLWjZpDYa1bo9JBO0Ea7UL57LhrkcD+EPtTTKnA/nin2MZiw== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f173.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.173 as permitted sender) identity=mailfrom; client-ip=209.85.223.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-io0-f173.google.com) identity=helo; client-ip=209.85.223.173; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-io0-f173.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BiAQD/GEtWm63fVdFeg1o0bwavAZFKIYVvAoFJBzwQAQEBAQEBAQEQAQEBAQEGCwsJIS6CLYIIAQEDARIRBBkBGxILAQMBCwYDAgsaHQICIQEBEQEFAQoSBhMIChCHdgEDCggNjWOPTYExPjGLSIFqgnmGKQoZJwMKVoQHAQEBAQEBBAEBAQEBAQEBFQEFDoZGhH6CU4I1gm2BRAWGCwyBKocMhBqDYoUhhhWBdYIkkk6GBhIkgRcRJ4IvI4FePTSDQCSBJgEBAQ X-IPAS-Result: A0BiAQD/GEtWm63fVdFeg1o0bwavAZFKIYVvAoFJBzwQAQEBAQEBAQEQAQEBAQEGCwsJIS6CLYIIAQEDARIRBBkBGxILAQMBCwYDAgsaHQICIQEBEQEFAQoSBhMIChCHdgEDCggNjWOPTYExPjGLSIFqgnmGKQoZJwMKVoQHAQEBAQEBBAEBAQEBAQEBFQEFDoZGhH6CU4I1gm2BRAWGCwyBKocMhBqDYoUhhhWBdYIkkk6GBhIkgRcRJ4IvI4FePTSDQCSBJgEBAQ X-IronPort-AV: E=Sophos;i="5.20,307,1444687200"; d="scan'208";a="187882895" Received: from mail-io0-f173.google.com ([209.85.223.173]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 17 Nov 2015 13:11:59 +0100 Received: by ioir85 with SMTP id r85so16168962ioi.1 for ; Tue, 17 Nov 2015 04:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=0F6gxN53EOclEwqqYP3mjkxXkrpNr8GpiLQYZEShbRE=; b=NIVYuGVHsPzCU6gx6ksPPYtj5L0TFqlb+JzsiTvjd/oNXacxEUd6B3D6xid6HX1VtT eCZK02bOlGspw5Ca8FQXgJKWPIzgZRETnhqII0BMhMSL5Rmlyjn4+wkYnegwJP/TAnoC GR38TMCmIKUZTMYmgDtL7YpS+enTeifbMivKgGPSY9MSkuvd+Wx7OLMchTS5MXUK6AWB hhRhKYzayBgviYiXELVjgNvSP2cAXljAiiLl1Vy5Yr3pOlt0yyvsC0DpF2q7ntrWBPoX m3feiDuUs9AdpcU48YTnhkVUlkc50yWzxGT7ypraYC0y04DbMqUAvN5NOEy3sm8DRycA fpUQ== X-Received: by 10.107.167.9 with SMTP id q9mr29470458ioe.84.1447762318777; Tue, 17 Nov 2015 04:11:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.39.200 with HTTP; Tue, 17 Nov 2015 04:11:19 -0800 (PST) In-Reply-To: <564B14B0.3020306@gmail.com> References: <564B14B0.3020306@gmail.com> From: Gabriel Scherer Date: Tue, 17 Nov 2015 13:11:19 +0100 Message-ID: To: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> Cc: caml users Content-Type: multipart/alternative; boundary=001a1142a30ebae3010524bb6e34 Subject: Re: [Caml-list] a question about annotations --001a1142a30ebae3010524bb6e34 Content-Type: text/plain; charset=UTF-8 Usage analysis is global and therefore not attached to a particular program point. Only localized warning can be disabled using @warning. A first question is why you would want to disable this warning: it seems indeed to be a valid thing to warn about. (If the constructor is exported through the .mli, then no warning will be emitted.) One valid case where one wants to silence the warning is if values of these types are only built by a C program on the other side of an OCaml/C FFI. Then a valid way to disable the warning is: let _ = function | Known_location (a, b, c, d, e) -> Kown_location (a, b, c, d ,e) | x -> x It might make sense to have an attribute [@mark_used] (or something like that) to silence the warning at the declaration site, but I don't think it currently exists. On Tue, Nov 17, 2015 at 12:51 PM, Matej Kosik < 5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote: > Dear Ocaml users, > > A few days ago there was a question about how to disable a specific > warning in a specific location > and the answer was to use > > [@warning "-"] > > annotation. > > I tried it myself. > By trial and error I was able to figure out how to use it with "function" > and "match" constructs. > > With this fragment: > > type raw_frame = > | Known_location of bool * string * int * int * int > | Unknown_location of bool (*is_raise*) > > I would like to temporarily disable warning 37: > > "Warning 37: constructor Known_location is never used to build > values. > (However, this constructor appears in patterns.)" > > However, by trial and error, I failed to figure out where is the proper > place to put the [@warning "-37"] annotation: > > Is there some document that describes where annotations are supported > and what do they mean? > > I have skimmed the Reference Manual, but unfortunatelly, I can't find any > relevant information. > Where should I look? > > Thanks in advance. > > -- > 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 > --001a1142a30ebae3010524bb6e34 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Usage analysis is global and= therefore not attached to a particular program point. Only localized warni= ng can be disabled using @warning.

A first question is why you= would want to disable this warning: it seems indeed to be a valid thing to= warn about. (If the constructor is exported through the .mli, then no warn= ing will be emitted.)

One valid case where one wants to silenc= e the warning is if values of these types are only built by a C program on = the other side of an OCaml/C FFI. Then a valid way to disable the warning i= s:

=C2=A0 let _ =3D function
=C2=A0=C2=A0 | Known_loc= ation (a, b, c, d, e) -> Kown_location (a, b, c, d ,e)
=C2=A0= =C2=A0 | x -> x

It might make sense to have an attribute [@= mark_used] (or something like that) to silence the warning at the declarati= on site, but I don't think it currently exists.

On Tue, Nov 17, 2015 at 12:51 P= M, Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmai= l.com> wrote:
Dear Ocaml us= ers,

A few days ago there was a question about how to disable a specific warning= in a specific location
and the answer was to use

=C2=A0 =C2=A0 =C2=A0 =C2=A0 [@warning "-<num>"]

annotation.

I tried it myself.
By trial and error I was able to figure out how to use it with "functi= on" and "match" constructs.

With this fragment:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 type raw_frame =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 | Known_location of bool * string * int * int *= int
=C2=A0 =C2=A0 =C2=A0 =C2=A0 | Unknown_location of bool (*is_raise*)

I would like to temporarily disable warning 37:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 "Warning 37: constructor Known_location is= never used to build values.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(However, this constructor appears in pat= terns.)"

However, by trial and error, I failed to figure out where is the proper pla= ce to put the [@warning "-37"] annotation:

Is there some document that describes where annotations are supported
and what do they mean?

I have skimmed the Reference Manual, but unfortunatelly, I can't find a= ny relevant information.
Where should I look?

Thanks in advance.

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a1142a30ebae3010524bb6e34--