From fcbd9addf6f8c10822294dc397d13af10b9d52f2 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 9 Jul 2019 14:31:21 +0200 Subject: Change condition for warning of conditional expr The warning should only be active if the optimization is active, so the check is only performed when the warning is active and additionally the command line flag -Obranchless is specified. --- cparser/Checks.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cparser') diff --git a/cparser/Checks.ml b/cparser/Checks.ml index a2602a52..ef62edd6 100644 --- a/cparser/Checks.ml +++ b/cparser/Checks.ml @@ -365,7 +365,7 @@ let non_linear_cond_stmt vars env s = iter_over_stmt_loc ~expr:(non_linear_cond_expr false vars env) ~decl:decl s let non_linear_conditional p = - if active_warning Non_linear_cond_expr then begin + if active_warning Non_linear_cond_expr && !Clflags.option_Obranchless then begin let fundef env loc fd = let vars = List.fold_left (add_vars env) IdentSet.empty fd.fd_params in let vars = non_stack_locals_stmt env vars fd.fd_body in -- cgit