11(* =============================================================================
2- CodeHawk C Analyzer
2+ CodeHawk C Analyzer
33 Author: Henny Sipma
44 ------------------------------------------------------------------------------
55 The MIT License (MIT)
6-
6+
77 Copyright (c) 2005-2019 Kestrel Technology LLC
88 Copyright (c) 2020-2024 Henny B. Sipma
99 Copyright (c) 2024 Aarno Labs LLC
1414 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1515 copies of the Software, and to permit persons to whom the Software is
1616 furnished to do so, subject to the following conditions:
17-
17+
1818 The above copyright notice and this permission notice shall be included in all
1919 copies or substantial portions of the Software.
20-
20+
2121 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2222 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2323 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3131open CHLanguage
3232open CHNumerical
3333open CHPretty
34-
34+
3535(* chutil *)
3636open CHPrettyUtil
37-
37+
3838(* xprlib *)
3939open XprTypes
40-
40+
4141(* cchlib *)
4242open CCHBasicTypes
4343open CCHFileContract
@@ -49,7 +49,7 @@ open CCHMemoryBase
4949open CCHPOPredicate
5050open CCHPreTypes
5151open CCHProofObligation
52-
52+
5353(* cchanalyze *)
5454open CCHAnalysisTypes
5555
@@ -59,10 +59,10 @@ let e2s e = p2s (exp_to_pretty e)
5959let cd = CCHDictionary. cdictionary
6060
6161(* -----------------------------------------------------------------------------
62- * The IH guarantees that any region pointed to by an argument is valid memory
63- * at function entry point (checked at the time of the call. Similarly any
62+ * The IH guarantees that any region pointed to by an argument is valid memory
63+ * at function entry point (checked at the time of the call) . Similarly any
6464 * region pointed to by a return value from a callee is valid memory at the
65- * point where the pointer value is received. For any other address
65+ * point where the pointer value is received. For any other address
6666 * locations received from outside the proof obligation should be delegated.
6767 * If the application does not contain any calls to free at all (indicated by
6868 * global_free) the valid-mem obligation is vacuously valid.
@@ -105,7 +105,7 @@ object (self)
105105 method private memref_to_string memref =
106106 " memory base: " ^ (p2s (memory_base_to_pretty memref#get_base))
107107
108-
108+
109109 (* ----------------------------- safe ------------------------------------- *)
110110
111111 method get_calls (v : variable_t ) =
@@ -237,7 +237,7 @@ object (self)
237237 end
238238 | _ ::tl ->
239239 let exps = List. map cd#get_exp (List. map int_of_string tl) in
240- let preds =
240+ let preds =
241241 List. map (fun e ->
242242 let pred = PDistinctRegion (e,v#getName#getSeqNumber) in
243243 begin
@@ -257,7 +257,7 @@ object (self)
257257 ^ (p2s v#toPretty) ^ " is not a fixed value" );
258258 None
259259 end
260-
260+
261261 method private call_preserves_validity (v : variable_t ) (sym : symbol_t ) =
262262 let sideeffects = poq#get_sym_sideeffects sym in
263263 let callee = poq#env#get_callsym_callee sym in
@@ -270,7 +270,7 @@ object (self)
270270 let msg = callee.vname ^ " preserves all memory" in
271271 Some (deps, msg)
272272 else if List. exists (fun (se , _ ) ->
273- match se with
273+ match se with
274274 | XPreservesAllMemoryX _ -> true
275275 | _ -> false ) sideeffects then
276276 let xexps = sym#getAttributes in
@@ -445,7 +445,7 @@ object (self)
445445 self#check_regions_safe inv
446446 | _ -> None in
447447 r
448-
448+
449449 method check_safe =
450450 self#global_free
451451 || (match invs with
@@ -480,7 +480,7 @@ object (self)
480480 end
481481 | _ -> false ) false einvs
482482 | _ -> false ))
483-
483+
484484 (* ----------------------- violation -------------------------------------- *)
485485 method check_violation = false
486486 (* ----------------------- delegation ------------------------------------- *)
@@ -524,7 +524,7 @@ object (self)
524524 | Some x -> self#xpr_implies_delegation inv#index x
525525 | _ -> None in
526526 r
527-
527+
528528 method check_delegation =
529529 match invs with
530530 | [] -> false
@@ -538,8 +538,8 @@ object (self)
538538 true
539539 end
540540 | _ -> false ) false invs
541-
542-
541+
542+
543543end
544544
545545
0 commit comments