From 7680c83f45acf265efdc8f80d6f1a86480f8f343 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Mon, 31 Jul 2017 10:21:37 -0700 Subject: [PATCH] [infer][build] enable the OCaml compiler unused value declaration warning Summary: This help when refactoring and removing code Reviewed By: jvillard Differential Revision: D5515933 fbshipit-source-id: 4de50fa --- infer/src/Makefile | 4 ++-- infer/src/base/Config.ml | 2 ++ infer/src/base/Config.mli | 2 ++ infer/src/bufferoverrun/itv.ml | 4 ---- infer/src/checkers/ThreadSafety.ml | 2 +- infer/src/checkers/annotationReachability.ml | 2 -- infer/src/integration/Driver.ml | 12 ------------ infer/src/unit/TaintTests.ml | 2 -- 8 files changed, 7 insertions(+), 23 deletions(-) diff --git a/infer/src/Makefile b/infer/src/Makefile index 115d4c095..f5277d7b7 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -24,7 +24,7 @@ ATDGEN_SUFFIXES = _t.ml _t.mli _j.ml _j.mli GENERATED_OCAML_SOURCES_GLOB = <*{clang_plugin/*,backend/jsonbug_*,checkers/stacktree_*}> -OCAML_FATAL_WARNINGS = +3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+33+34+35+37+38+39+50+52+57 +OCAML_FATAL_WARNINGS = +3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+32+33+34+35+37+38+39+50+52+57 # options for ocamlbuild # Notice that use-ocamlfind is used here to avoid a linker bug in ocamlbuild when using -tag thread @@ -38,7 +38,7 @@ OCAMLBUILD_OPTIONS = \ -cflags -principal \ -cflags -strict-formats \ -cflags -strict-sequence \ - -cflags -w,$(OCAML_FATAL_WARNINGS)-4-9-32-40-41-42-45-48 \ + -cflags -w,$(OCAML_FATAL_WARNINGS)-4-9-40-41-42-45-48 \ -tag-line "$(GENERATED_OCAML_SOURCES_GLOB): warn(-27-32-34-35-39)" \ -tag-line "not $(GENERATED_OCAML_SOURCES_GLOB) and <*/{,*/}*.{ml,re}{,i}>: package(ppx_compare)" \ -tag-line "not $(GENERATED_OCAML_SOURCES_GLOB) and not <*{base/IList,base/IStd}.*>: open(IStd)" \ diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 4c71ebc13..1e1285adc 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1914,6 +1914,8 @@ and debug_exceptions = !debug_exceptions and debug_mode = !debug +and default_checkers = !default_checkers + and default_linters = !default_linters and dependency_mode = !dependencies diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 1e16721bc..cb8757521 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -105,6 +105,8 @@ val relative_cpp_models_dir : string val csl_analysis : bool +val default_checkers : bool + val default_failure_name : string val default_in_zip_results_dir : string diff --git a/infer/src/bufferoverrun/itv.ml b/infer/src/bufferoverrun/itv.ml index 798f717da..bf8e5eccc 100644 --- a/infer/src/bufferoverrun/itv.ml +++ b/infer/src/bufferoverrun/itv.ml @@ -181,10 +181,6 @@ module Bound = struct let of_int : int -> t = fun n -> Linear (n, SymLinear.empty) - let zero = of_int 0 - - let one = of_int 1 - let minus_one = of_int (-1) let _255 = of_int 255 diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 2c737a469..1ed9cccdb 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -1174,7 +1174,7 @@ let report_thread_safety_violation tenv pdesc ~make_description ~conflicts acces let trace_of_pname = trace_of_pname access pdesc in Option.iter ~f:report_one_path (PathDomain.get_reportable_sink_path access ~trace_of_pname) -let report_unannotated_interface_violation tenv pdesc access reported_pname = +let _report_unannotated_interface_violation tenv pdesc access reported_pname = match reported_pname with | Typ.Procname.Java java_pname -> let class_name = Typ.Procname.java_get_class_name java_pname in diff --git a/infer/src/checkers/annotationReachability.ml b/infer/src/checkers/annotationReachability.ml index 1405f73ba..643560b5d 100644 --- a/infer/src/checkers/annotationReachability.ml +++ b/infer/src/checkers/annotationReachability.ml @@ -248,8 +248,6 @@ module AnnotationSpec = struct (* The default sanitizer does not sanitize anything *) let default_sanitizer _ _ = false - (* The default report function does not report anything *) - let default_report _ _ = () end module StandardAnnotationSpec = struct diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index 6fb977b6e..fc63a1a85 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -510,18 +510,6 @@ let mode_of_build_command build_cmd = | BAnt | BBuck | BGradle | BNdk | BXcode as build_system -> PythonCapture (build_system, build_cmd) -let get_mode () = - match Config.generated_classes with - | _ when Config.maven - -> (* infer is pretending to be javac in the Maven integration *) - let build_args = match Array.to_list Sys.argv with _ :: args -> args | [] -> [] in - Javac (Javac.Javac, "javac", build_args) - | Some path - -> assert_supported_mode `Java "Buck genrule" ; - BuckGenrule path - | None - -> mode_of_build_command (List.rev Config.rest) - let mode_from_command_line = ( lazy ( match Config.generated_classes with diff --git a/infer/src/unit/TaintTests.ml b/infer/src/unit/TaintTests.ml index 52e08babc..1965fced7 100644 --- a/infer/src/unit/TaintTests.ml +++ b/infer/src/unit/TaintTests.ml @@ -33,8 +33,6 @@ module MockTrace = Trace.Make (struct if String.is_prefix ~prefix:"SINK" (Typ.Procname.to_string pname) then Some (CallSite.make pname Location.dummy, IntSet.singleton 0) else None - - let indexes _ = IntSet.empty end) let should_report _ _ = false