[infer][checkers] remove the bufferoverrun analyzer option and rely on the --bufferoverrun flag only

Summary:
The bufferoverrun checkers can now be run with:
  infer -a checkers --bufferoverrun -- ...

Reviewed By: jeremydubreil

Differential Revision: D5010689

fbshipit-source-id: 2eaa396
master
Mehdi Bouaziz 8 years ago committed by Facebook Github Bot
parent 8064ac2614
commit 5a57be9003

@ -272,7 +272,6 @@ let should_report (issue_kind: Exceptions.err_kind) issue_type error_desc eclass
| Checkers | Checkers
| Eradicate | Eradicate
| Tracing => true | Tracing => true
| Bufferoverrun
| Capture | Capture
| Compile | Compile
| Crashcontext | Crashcontext

@ -375,7 +375,7 @@ let analyze driver_mode =
false, false false, false
| _, (Capture | Compile) -> | _, (Capture | Compile) ->
false, false false, false
| _, (Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary | Bufferoverrun) -> | _, (Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary) ->
true, true true, true
| _, Linters -> | _, Linters ->
false, true in false, true in

@ -37,7 +37,6 @@ let frontend_parse_modes = CLOpt.(Infer [Clang])
type analyzer = type analyzer =
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary
| Bufferoverrun
[@@deriving compare] [@@deriving compare]
let equal_analyzer = [%compare.equal : analyzer] let equal_analyzer = [%compare.equal : analyzer]
@ -46,7 +45,7 @@ let string_to_analyzer =
[("capture", Capture); ("compile", Compile); [("capture", Capture); ("compile", Compile);
("infer", Infer); ("eradicate", Eradicate); ("checkers", Checkers); ("infer", Infer); ("eradicate", Eradicate); ("checkers", Checkers);
("tracing", Tracing); ("crashcontext", Crashcontext); ("linters", Linters); ("tracing", Tracing); ("crashcontext", Crashcontext); ("linters", Linters);
("quandary", Quandary); ("bufferoverrun", Bufferoverrun)] ("quandary", Quandary)]
let string_of_analyzer a = let string_of_analyzer a =
List.find_exn ~f:(fun (_, a') -> equal_analyzer a a') string_to_analyzer |> fst List.find_exn ~f:(fun (_, a') -> equal_analyzer a a') string_to_analyzer |> fst
@ -482,11 +481,11 @@ and analyzer =
(* NOTE: if compilation fails here, it means you have added a new analyzer without updating the (* NOTE: if compilation fails here, it means you have added a new analyzer without updating the
documentation of this option *) documentation of this option *)
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters
| Quandary | Bufferoverrun -> () in | Quandary -> () in
CLOpt.mk_symbol_opt ~deprecated:["analyzer"] ~long:"analyzer" ~short:'a' CLOpt.mk_symbol_opt ~deprecated:["analyzer"] ~long:"analyzer" ~short:'a'
~parse_mode:CLOpt.(Infer [Driver]) ~parse_mode:CLOpt.(Infer [Driver])
"Specify which analyzer to run (only one at a time is supported):\n\ "Specify which analyzer to run (only one at a time is supported):\n\
- infer, eradicate, checkers, quandary, bufferoverrun: run the specified analysis\n\ - infer, eradicate, checkers, quandary: run the specified analysis\n\
- capture: run capture phase only (no analysis)\n\ - capture: run capture phase only (no analysis)\n\
- compile: run compilation command without interfering (not supported by all frontends)\n\ - compile: run compilation command without interfering (not supported by all frontends)\n\
- crashcontext, tracing: experimental (see --crashcontext and --tracing)\n\ - crashcontext, tracing: experimental (see --crashcontext and --tracing)\n\
@ -558,6 +557,10 @@ and buck_out =
CLOpt.mk_path_opt ~long:"buck-out" CLOpt.mk_path_opt ~long:"buck-out"
~parse_mode:CLOpt.(Infer [Driver]) ~meta:"dir" "Specify the root directory of buck-out" ~parse_mode:CLOpt.(Infer [Driver]) ~meta:"dir" "Specify the root directory of buck-out"
and bufferoverrun =
CLOpt.mk_bool ~long:"bufferoverrun" ~parse_mode:CLOpt.(Infer [Checkers])
"Activate the buffer overrun analysis"
and bugs_csv = and bugs_csv =
CLOpt.mk_path_opt ~deprecated:["bugs"] ~long:"issues-csv" CLOpt.mk_path_opt ~deprecated:["bugs"] ~long:"issues-csv"
~parse_mode:CLOpt.(Infer [Driver;Print]) ~parse_mode:CLOpt.(Infer [Driver;Print])
@ -591,17 +594,12 @@ and changed_files_index =
"Specify the file containing the list of source files from which reactive analysis should \ "Specify the file containing the list of source files from which reactive analysis should \
start. Source files should be specified relative to project root or be absolute" start. Source files should be specified relative to project root or be absolute"
and bufferoverrun, checkers, checkers_repeated_calls, and checkers, checkers_repeated_calls,
eradicate, quandary = eradicate, quandary =
let checkers = let checkers =
CLOpt.mk_bool ~deprecated:["checkers"] ~long:"checkers" CLOpt.mk_bool ~deprecated:["checkers"] ~long:"checkers"
"Activate the checkers instead of the full analysis" "Activate the checkers instead of the full analysis"
in in
let bufferoverrun =
CLOpt.mk_bool_group ~long:"bufferoverrun"
"Activate the buffer overrun analysis"
[checkers] []
in
let checkers_repeated_calls = let checkers_repeated_calls =
CLOpt.mk_bool_group ~long:"checkers-repeated-calls" CLOpt.mk_bool_group ~long:"checkers-repeated-calls"
"Check for repeated calls" "Check for repeated calls"
@ -617,7 +615,7 @@ and bufferoverrun, checkers, checkers_repeated_calls,
"Activate the quandary taint analysis" "Activate the quandary taint analysis"
[checkers] [] [checkers] []
in in
(bufferoverrun, checkers, checkers_repeated_calls, (checkers, checkers_repeated_calls,
eradicate, quandary) eradicate, quandary)
and clang_biniou_file = and clang_biniou_file =
@ -1554,7 +1552,6 @@ let post_parsing_initialization () =
| Some Crashcontext -> checkers := true; crashcontext := true | Some Crashcontext -> checkers := true; crashcontext := true
| Some Eradicate -> checkers := true; eradicate := true | Some Eradicate -> checkers := true; eradicate := true
| Some Quandary -> checkers := true; quandary := true | Some Quandary -> checkers := true; quandary := true
| Some Bufferoverrun -> checkers := true; bufferoverrun := true
| Some Tracing -> tracing := true | Some Tracing -> tracing := true
| Some (Capture | Compile | Infer | Linters) | None -> () | Some (Capture | Compile | Infer | Linters) | None -> ()

@ -20,7 +20,6 @@ val exe_name : exe -> string
(** Various kind of analyzers *) (** Various kind of analyzers *)
type analyzer = type analyzer =
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary
| Bufferoverrun
[@@deriving compare] [@@deriving compare]
val equal_analyzer : analyzer -> analyzer -> bool val equal_analyzer : analyzer -> analyzer -> bool

@ -116,7 +116,7 @@ let clang_cc1_cmd_sanitizer cmd => {
arg arg
}; };
let args_defines = let args_defines =
if (Config.bufferoverrun || Config.equal_analyzer Config.analyzer Config.Bufferoverrun) { if (Config.bufferoverrun) {
["-D__INFER_BUFFEROVERRUN"] ["-D__INFER_BUFFEROVERRUN"]
} else { } else {
[] []

@ -51,7 +51,7 @@ let add_flavor_to_target target =
target target
| None, (Linters | Capture) -> | None, (Linters | Capture) ->
add "infer-capture-all" add "infer-capture-all"
| None, (Bufferoverrun | Checkers | Infer | Quandary) -> | None, (Checkers | Infer | Quandary) ->
add "infer" add "infer"
| None, (Eradicate | Tracing | Crashcontext) -> | None, (Eradicate | Tracing | Crashcontext) ->
failwithf "Analyzer %s is Java-only; not supported with Buck flavors" failwithf "Analyzer %s is Java-only; not supported with Buck flavors"

@ -10,9 +10,9 @@
TESTS_DIR = ../../.. TESTS_DIR = ../../..
ANALYZER = bufferoverrun ANALYZER = checkers
CLANG_OPTIONS = -c CLANG_OPTIONS = -c
INFER_OPTIONS = -F --project-root $(TESTS_DIR) --no-failures-allowed INFER_OPTIONS = --bufferoverrun -F --project-root $(TESTS_DIR) --no-failures-allowed
INFERPRINT_OPTIONS = --issues-tests INFERPRINT_OPTIONS = --issues-tests
SOURCES = $(wildcard *.c) SOURCES = $(wildcard *.c)

@ -7,10 +7,11 @@
TESTS_DIR = ../../.. TESTS_DIR = ../../..
ANALYZER = bufferoverrun ANALYZER = checkers
# see explanations in cpp/errors/Makefile for the custom isystem # see explanations in cpp/errors/Makefile for the custom isystem
CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c
INFER_OPTIONS = --ml-buckets cpp --no-filtering --debug-exceptions --project-root $(TESTS_DIR) --no-failures-allowed INFER_OPTIONS = --bufferoverrun --ml-buckets cpp --no-filtering --debug-exceptions \
--project-root $(TESTS_DIR) --no-failures-allowed
INFERPRINT_OPTIONS = --issues-tests INFERPRINT_OPTIONS = --issues-tests
SOURCES = $(wildcard *.cpp) SOURCES = $(wildcard *.cpp)

Loading…
Cancel
Save