From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 333BC7EE99 for ; Wed, 11 Dec 2013 16:07:38 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=193.252.23.213; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=193.252.23.213; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@msa.smtpout.orange.fr) identity=helo; client-ip=193.252.23.213; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@msa.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIBAFt/qFLB/BfVnGdsb2JhbABZgz+DVrVOToEyDgEBAQEBCAsJCRQogiUBAQUjFUARCxgCAgUWCwICCQMCAQIBRQYBDAgBAYgCCbInj1oXgSmNZoJsgUgEmBSBMIUVjng X-IPAS-Result: AuIBAFt/qFLB/BfVnGdsb2JhbABZgz+DVrVOToEyDgEBAQEBCAsJCRQogiUBAQUjFUARCxgCAgUWCwICCQMCAQIBRQYBDAgBAYgCCbInj1oXgSmNZoJsgUgEmBSBMIUVjng X-IronPort-AV: E=Sophos;i="4.93,872,1378850400"; d="scan'208";a="40495687" Received: from msa04.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.213]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Dec 2013 16:07:37 +0100 Received: from [192.168.1.132] ([92.151.55.247]) by mwinf5d13 with ME id 0F7c1n00U5L1vSL03F7c9b; Wed, 11 Dec 2013 16:07:37 +0100 Message-ID: <52A87FB7.8010807@frisch.fr> Date: Wed, 11 Dec 2013 16:07:35 +0100 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Pierre-Yves Strub , caml-list@inria.fr References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Dead code detection At LexiFi, we use two different techniques for detecting dead code: - Bisect, for a dynamic notion of "dead code" (i.e. code which is not exercised by our testsuite). - A custom static detection tool, which parses .cmt and .cmi files to detect exported components (values, exceptions, etc) used by no other module in the project. This is of course combined with the existing compiler warnings on locally unused and non-exported declarations. The next version of OCaml will make it extremely simple to implement such a static detection tool. This is because of the new -keep-locs compiler flag, which allows us to keep the location of exported values in .cmi files, and thus retrieve the same locations on references to such values in .cmt files. It makes it very easy to create the link between an exported value and its references in external modules, even if this goes through e.g. module inclusions. As a proof of concept of this approach, we can already try the tool experimental/frisch/unused_exported_values.ml in the trunk: http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/trunk/experimental/frisch/unused_exported_values.ml?revision=HEAD&view=markup (-keep-locs also gives "for free" a jump-to-definition feature, just by parsing .cmt or .annot files.) Hope this helps, Alain On 12/11/2013 03:52 PM, Pierre-Yves Strub wrote: > Hi all, > > Does any of you know a tool for doing dead code detection? > > Thanks, > -- Pierre-Yves. > >