Skip to content

Commit 3f1194e

Browse files
committed
CHB: fix warnings and remove some obsolete files
1 parent 015fb7f commit 3f1194e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+431
-1114
lines changed

CodeHawk/CHB/bchanalyze/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ MLIS := \
4343
bCHReachingDefs \
4444
bCHDefUse \
4545
bCHDefUseHigh \
46-
bCHTypeConstantsDomainNoArrays \
47-
bCHDesignation \
4846
bCHFileIO \
4947
bCHTrace \
5048
bCHAnalyzeApp \
@@ -60,8 +58,6 @@ SOURCES := \
6058
bCHReachingDefs \
6159
bCHDefUse \
6260
bCHDefUseHigh \
63-
bCHTypeConstantsDomainNoArrays \
64-
bCHDesignation \
6561
bCHFileIO \
6662
bCHTrace \
6763
bCHAnalyzeApp \

CodeHawk/CHB/bchanalyze/bCHAnalysisTypes.mli

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,10 @@
2929

3030
(* chlib *)
3131
open CHAtlas
32-
open CHIntervals
3332
open CHLanguage
3433
open CHNumericalConstraints
3534
open CHPretty
3635

37-
(* chutil *)
38-
open CHXmlDocument
39-
40-
(* bchlib *)
41-
open BCHLibTypes
42-
43-
(* bchlibx86 *)
44-
open BCHLibx86Types
45-
4636

4737
class type constraint_set_int =
4838
object ('a)

CodeHawk/CHB/bchanalyze/bCHAnalyzeApp.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ open BCHDoubleword
4141
open BCHLibTypes
4242
open BCHFunctionInfo
4343
open BCHMetrics
44-
open BCHSystemInfo
4544
open BCHSystemSettings
4645

4746
(* bchlibx86 *)
@@ -68,7 +67,6 @@ open BCHARMAssemblyFunctions
6867
open BCHARMCHIFSystem
6968
open BCHARMLoopStructure
7069
open BCHARMMetrics
71-
open BCHFnARMDictionary
7270
open BCHTranslateARMToCHIF
7371

7472
(* bchlibpower32 *)
@@ -83,7 +81,6 @@ open BCHTranslatePowerToCHIF
8381
open BCHAnalyzeProcedure
8482
open BCHDefUse
8583
open BCHDefUseHigh
86-
open BCHDesignation
8784
open BCHExtractInvariants
8885
open BCHFileIO
8986
open BCHReachingDefs
@@ -534,7 +531,6 @@ let analyze_arm_function faddr f count =
534531
analyze_procedure_with_valuesets proc arm_chif_system#get_arm_system;
535532
(if system_settings#generate_varinvs then
536533
begin
537-
analyze_procedure_with_designations proc arm_chif_system#get_arm_system;
538534
analyze_procedure_with_reaching_defs proc arm_chif_system#get_arm_system;
539535
analyze_procedure_with_flag_reaching_defs
540536
proc arm_chif_system#get_arm_system;
@@ -553,7 +549,6 @@ let analyze_arm_function faddr f count =
553549
extract_valuesets finfo bb_invariants#get_invariants;
554550
(if system_settings#generate_varinvs then
555551
begin
556-
extract_designations finfo bb_invariants#get_invariants;
557552
extract_reaching_defs finfo bb_invariants#get_invariants;
558553
extract_flag_reaching_defs finfo bb_invariants#get_invariants;
559554
extract_def_use finfo bb_invariants#get_invariants;

CodeHawk/CHB/bchanalyze/bCHAnalyzeProcedure.ml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(* =============================================================================
2-
CodeHawk Binary Analyzer
2+
CodeHawk Binary 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 Henny B. Sipma
99
Copyright (c) 2021-2024 Aarno Labs LLC
@@ -14,10 +14,10 @@
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
@@ -39,23 +39,25 @@ open CHAnalysisSetup
3939
(* bchanalyze *)
4040
open BCHAnalysisTypes
4141

42+
[@@@warning "-27"]
43+
4244
module H = Hashtbl
4345

4446

4547
class bb_invariants_t:bb_invariants_int =
4648
object
4749
val invariants = H.create 3
48-
50+
4951
method reset = H.clear invariants
50-
52+
5153
method add_invariant (opname:string) (domain:string) (inv:atlas_t) =
5254
let optable = if H.mem invariants opname then
53-
H.find invariants opname
55+
H.find invariants opname
5456
else
5557
let table = H.create 1 in
56-
begin H.add invariants opname table ; table end in
58+
begin H.add invariants opname table; table end in
5759
H.replace optable domain inv
58-
60+
5961
method get_invariants = invariants
6062

6163
method toPretty =
@@ -69,44 +71,48 @@ object
6971
result := p :: !result) varinvs) invariants;
7072
LBLOCK (List.rev !result)
7173
end
72-
74+
7375
end
7476

7577
let bb_invariants = new bb_invariants_t
7678

77-
let default_opsemantics domain =
79+
let default_opsemantics domain =
7880
fun ~invariant ~stable ~fwd_direction ~context ~operation ->
79-
let _ = if stable then
80-
if operation.op_name#getBaseName = "invariant" then
81-
bb_invariants#add_invariant (List.hd (operation.op_name#getAttributes)) domain invariant in
81+
let _ =
82+
if stable then
83+
if operation.op_name#getBaseName = "invariant" then
84+
bb_invariants#add_invariant
85+
(List.hd (operation.op_name#getAttributes)) domain invariant in
8286
invariant
8387

84-
let analyze_procedure_with_linear_equalities (proc:procedure_int) (system:system_int) =
88+
let analyze_procedure_with_linear_equalities
89+
(proc:procedure_int) (system:system_int) =
8590
let analysis_setup = mk_analysis_setup () in
8691
begin
87-
analysis_setup#addLinearEqualities ;
88-
analysis_setup#setOpSemantics (default_opsemantics "karr") ;
89-
analysis_setup#analyze_procedure system proc
92+
analysis_setup#addLinearEqualities;
93+
analysis_setup#setOpSemantics (default_opsemantics "karr");
94+
analysis_setup#analyze_procedure system proc
9095
end
9196

9297
let analyze_procedure_with_intervals (proc:procedure_int) (system:system_int) =
9398
let analysis_setup = mk_analysis_setup () in
9499
begin
95-
analysis_setup#addIntervals ;
96-
analysis_setup#setOpSemantics (default_opsemantics "intervals") ;
97-
analysis_setup#analyze_procedure system proc
100+
analysis_setup#addIntervals;
101+
analysis_setup#setOpSemantics (default_opsemantics "intervals");
102+
analysis_setup#analyze_procedure system proc
98103
end
99-
104+
100105
let analyze_procedure_with_valuesets (proc:procedure_int) (system:system_int) =
101106
let analysis_setup = mk_analysis_setup () in
102107
begin
103-
analysis_setup#addValueSets ;
104-
analysis_setup#setOpSemantics (default_opsemantics "valuesets") ;
108+
analysis_setup#addValueSets;
109+
analysis_setup#setOpSemantics (default_opsemantics "valuesets");
105110
analysis_setup#analyze_procedure system proc
106111
end
107112

108113

109-
let analyze_procedure_with_symbolic_sets (proc: procedure_int) (system: system_int) =
114+
let analyze_procedure_with_symbolic_sets
115+
(proc: procedure_int) (system: system_int) =
110116
let analysis_setup = mk_analysis_setup () in
111117
begin
112118
analysis_setup#addDomain "symbolicsets" (new symbolic_sets_domain_no_arrays_t);
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
(* =============================================================================
2-
CodeHawk Binary Analyzer
2+
CodeHawk Binary 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 Henny Sipma
9-
Copyright (c) 2021-2022 Aarno Labs LLC
9+
Copyright (c) 2021-2024 Aarno Labs LLC
1010
1111
Permission is hereby granted, free of charge, to any person obtaining a copy
1212
of this software and associated documentation files (the "Software"), to deal
1313
in the Software without restriction, including without limitation the rights
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
@@ -29,14 +29,17 @@
2929

3030
(* chlib *)
3131
open CHLanguage
32-
32+
3333
(* bchanalyze *)
3434
open BCHAnalysisTypes
3535

3636

3737
val bb_invariants: bb_invariants_int
3838

3939
val analyze_procedure_with_linear_equalities: procedure_int -> system_int -> unit
40+
4041
val analyze_procedure_with_intervals: procedure_int -> system_int -> unit
42+
4143
val analyze_procedure_with_valuesets: procedure_int -> system_int -> unit
44+
4245
val analyze_procedure_with_symbolic_sets: procedure_int -> system_int -> unit

CodeHawk/CHB/bchanalyze/bCHDefUse.ml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(* =============================================================================
2-
CodeHawk Binary Analyzer
2+
CodeHawk Binary Analyzer
33
Author: Henny Sipma
44
------------------------------------------------------------------------------
55
The MIT License (MIT)
6-
6+
77
Copyright (c) 2022-2024 Aarno Labs LLC
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -12,10 +12,10 @@
1212
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1313
copies of the Software, and to permit persons to whom the Software is
1414
furnished to do so, subject to the following conditions:
15-
15+
1616
The above copyright notice and this permission notice shall be included in all
1717
copies or substantial portions of the Software.
18-
18+
1919
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2020
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2121
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -28,12 +28,10 @@
2828
(* chlib *)
2929
open CHAtlas
3030
open CHCommon
31-
open CHDomain
3231
open CHIterator
3332
open CHLanguage
3433
open CHNonRelationalDomainNoArrays
3534
open CHNonRelationalDomainValues
36-
open CHOnlineCodeSet
3735
open CHSymbolicSets
3836
open CHPretty
3937

@@ -44,6 +42,7 @@ open BCHLibTypes
4442
(* bchanalyze *)
4543
open BCHAnalyzeProcedure
4644

45+
[@@@warning "-27"]
4746

4847
module H = Hashtbl
4948
module LF = CHOnlineCodeSet.LanguageFactory
@@ -71,7 +70,7 @@ object (self: 'a)
7170
method private setValue' t v x =
7271
self#setValue t v (new non_relational_domain_value_t (SYM_SET_VAL x))
7372

74-
method special cmd args = {< >}
73+
method special _cmd _args = {< >}
7574

7675
method private importValue v =
7776
new non_relational_domain_value_t (SYM_SET_VAL (v#toSymbolicSet))
@@ -132,7 +131,7 @@ object (self: 'a)
132131
| _ ->
133132
default ()
134133

135-
method analyzeOperation
134+
method !analyzeOperation
136135
~(domain_name: string)
137136
~(fwd_direction: bool)
138137
~(operation: operation_t):'a =
@@ -146,7 +145,7 @@ object (self: 'a)
146145
self#abstractVariables table' [v]) operation.op_args;
147146
default ()
148147
end
149-
148+
150149
| "use" ->
151150
let (v, sym) =
152151
match operation.op_args with
@@ -157,7 +156,10 @@ object (self: 'a)
157156
| _ ->
158157
raise
159158
(BCH_failure
160-
(LBLOCK [STR "Error in defuse:analyzeOperation"])) in
159+
(LBLOCK [
160+
STR "Error in defuse:analyzeOperation. ";
161+
STR "Domain name: ";
162+
STR domain_name])) in
161163
let symbols = (self#getValue' v)#getSymbols in
162164
(match symbols with
163165
| TOP ->
@@ -185,11 +187,11 @@ object (self: 'a)
185187
self#setValue' table' v newsyms;
186188
default ()
187189
end)
188-
190+
189191
| _ ->
190192
default ()
191193

192-
end
194+
end
193195

194196

195197
let get_vardefuse (op: CHLanguage.operation_t):(variable_t * symbolic_exp_t) =
@@ -202,13 +204,13 @@ let get_vardefuse (op: CHLanguage.operation_t):(variable_t * symbolic_exp_t) =
202204
(LBLOCK [STR "Error in get_vardefuse"]))
203205

204206

205-
let symbolic_exp_to_pretty (s: symbolic_exp_t) =
207+
let _symbolic_exp_to_pretty (s: symbolic_exp_t) =
206208
match s with
207209
| SYM sym -> sym#toPretty
208210
| SYM_VAR v -> v#toPretty
209211

210212

211-
let get_opvar (op: operation_t) =
213+
let _get_opvar (op: operation_t) =
212214
match op.op_args with
213215
| [(_, v, _)] -> v#toPretty
214216
| _ -> STR "?"
@@ -229,7 +231,7 @@ let opsemantics (domain: string) =
229231
bb_invariants#add_invariant iaddr domain invariant in
230232
invariant
231233
| "def" | "clobber" ->
232-
let (v, sym) = get_vardefuse operation in
234+
let (v, _sym) = get_vardefuse operation in
233235
if fwd_direction then
234236
invariant#analyzeFwd (ABSTRACT_VARS [v])
235237
else
@@ -240,7 +242,7 @@ let opsemantics (domain: string) =
240242
invariant#analyzeFwd (ASSIGN_SYM (v, sym))
241243
else
242244
invariant#analyzeBwd (ASSIGN_SYM (v, sym))
243-
| s ->
245+
| _ ->
244246
invariant
245247

246248

0 commit comments

Comments
 (0)