Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file lint.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114(****************************************************************************)(* Sail *)(* *)(* Sail and the Sail architecture models here, comprising all files and *)(* directories except the ASL-derived Sail code in the aarch64 directory, *)(* are subject to the BSD two-clause licence below. *)(* *)(* The ASL derived parts of the ARMv8.3 specification in *)(* aarch64/no_vector and aarch64/full are copyright ARM Ltd. *)(* *)(* Copyright (c) 2013-2021 *)(* Kathyrn Gray *)(* Shaked Flur *)(* Stephen Kell *)(* Gabriel Kerneis *)(* Robert Norton-Wright *)(* Christopher Pulte *)(* Peter Sewell *)(* Alasdair Armstrong *)(* Brian Campbell *)(* Thomas Bauereiss *)(* Anthony Fox *)(* Jon French *)(* Dominic Mulligan *)(* Stephen Kell *)(* Mark Wassell *)(* Alastair Reid (Arm Ltd) *)(* *)(* All rights reserved. *)(* *)(* This work was partially supported by EPSRC grant EP/K008528/1 <a *)(* href="http://www.cl.cam.ac.uk/users/pes20/rems">REMS: Rigorous *)(* Engineering for Mainstream Systems</a>, an ARM iCASE award, EPSRC IAA *)(* KTF funding, and donations from Arm. This project has received *)(* funding from the European Research Council (ERC) under the European *)(* Union’s Horizon 2020 research and innovation programme (grant *)(* agreement No 789108, ELVER). *)(* *)(* This software was developed by SRI International and the University of *)(* Cambridge Computer Laboratory (Department of Computer Science and *)(* Technology) under DARPA/AFRL contracts FA8650-18-C-7809 ("CIFV") *)(* and FA8750-10-C-0237 ("CTSRD"). *)(* *)(* SPDX-License-Identifier: BSD-2-Clause *)(****************************************************************************)openAstopenAst_defsopenAst_utilletscan_exp_in_pexpf(Pat_aux(aux,_))=matchauxwith|Pat_exp(_,exp)->fexp|Pat_when(_,guard,exp)->fguard;fexpletscan_exp_in_funclf(FCL_aux(FCL_funcl(_,pexp),_))=scan_exp_in_pexpfpexpletscan_exp_in_mpexpf(MPat_aux(aux,_))=matchauxwithMPat_when(_,exp)->fexp|MPat_pat_->()letscan_exp_in_mapclf(MCL_aux(aux,_))=matchauxwith|MCL_forwardspexp|MCL_backwardspexp->scan_exp_in_pexpfpexp|MCL_bidir(left,right)->scan_exp_in_mpexpfleft;scan_exp_in_mpexpfrightletscan_exp_in_scattered_deff(SD_aux(aux,_))=matchauxwith|SD_function_|SD_unioncl_|SD_variant_|SD_internal_unioncl_record_|SD_enumcl_|SD_enum_|SD_mapping_|SD_end_->()|SD_funclfuncl->scan_exp_in_funclffuncl|SD_mapcl(_,mapcl)->scan_exp_in_mapclfmapclletscan_exp_in_fundeff(FD_aux(FD_function(_,_,funcls),_))=List.iter(scan_exp_in_funclf)funclsletrecscan_exp_in_deff(DEF_aux(aux,_))=matchauxwith|DEF_fundeffdef->scan_exp_in_fundefffdef|DEF_mapdef(MD_aux(MD_mapping(_,_,mapcls),_))->List.iter(scan_exp_in_mapclf)mapcls|DEF_register(DEC_aux(DEC_reg(_,_,exp_opt),_))->Option.iterfexp_opt|DEF_outcome(_,defs)->List.iter(scan_exp_in_deff)defs|DEF_implfuncl->scan_exp_in_funclffuncl|DEF_let(LB_aux(LB_val(_,exp),_))->fexp|DEF_scatteredsdef->scan_exp_in_scattered_deffsdef|DEF_internal_mutrecfdefs->List.iter(scan_exp_in_fundeff)fdefs|DEF_loop_measures_->()|DEF_measure(_,_,exp)->fexp|DEF_type_|DEF_constraint_|DEF_val_|DEF_fixity_|DEF_overload_|DEF_default_|DEF_pragma_|DEF_instantiation_->()letwarn_unmodified_variablesast=letwarn_unused(lexp,bind,exp)=letunused=IdSet.difflexpexpinIdSet.iter(funid->Reporting.warn"Unnecessary mutability"(id_locid)"This variable is mutable, but it is never modified. It could be declared as immutable using 'let'.")unused;IdSet.union(IdSet.diffexplexp)bindinletalg={(Rewriter.pure_exp_algIdSet.emptyIdSet.union)withle_id=IdSet.singleton;le_typ=(fun(_,id)->IdSet.singletonid);e_var=warn_unused;}inList.iter(scan_exp_in_def(funexp->ignore(Rewriter.fold_expalgexp)))ast.defs