Skip to content

Commit c5e6d7a

Browse files
committed
CHT: fix warnings and add tests to dune files
1 parent 3f1194e commit c5e6d7a

25 files changed

+62
-219
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ _build/
2525
*.mli~
2626
*.sh~
2727
*.yaml~
28+
*.i~
2829
.gitignore~
2930

3031
# binary analyzer executables

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHARMFunctionInterfaceTest.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ let get_arm_int_param_next_state_test () =
5858
TS.new_testsuite
5959
(testname ^ "_get_int_paramloc_next_test") lastupdated;
6060

61-
List.iter (fun (title, nxtreg, xlocreg, xnxtreg, xnxtoff) ->
61+
List.iter (fun (title, nxtreg, _xlocreg, xnxtreg, xnxtoff) ->
6262
TS.add_simple_test
6363
~title
6464
(fun () ->
6565
let aas = {aas_start_state with aas_next_core_reg = Some nxtreg} in
66-
let (par, naas) = get_arm_int_param_next_state 4 "name" t_int aas 1 in
66+
let (_par, naas) = get_arm_int_param_next_state 4 "name" t_int aas 1 in
6767
let xnaas =
6868
{aas_start_state with
6969
aas_next_core_reg = xnxtreg; aas_next_offset = xnxtoff} in
@@ -76,7 +76,7 @@ let get_arm_int_param_next_state_test () =
7676
let aas =
7777
{aas_start_state with
7878
aas_next_core_reg = None; aas_next_offset = Some 0} in
79-
let (par, naas) = get_arm_int_param_next_state 4 "name" t_int aas 1 in
79+
let (_par, naas) = get_arm_int_param_next_state 4 "name" t_int aas 1 in
8080
let xnaas = {aas with aas_next_offset = Some 4} in
8181
BA.equal_arm_argument_state ~expected:xnaas ~received:naas ());
8282

@@ -105,14 +105,14 @@ let get_arm_struct_field_locations_test () =
105105

106106
parse_cil_file ~removeUnused:false "header.i";
107107

108-
List.iter (fun (title, locations) ->
108+
List.iter (fun (title, _locations) ->
109109
TS.add_simple_test
110110
~title
111111
(fun () ->
112112
let cinfo = bcfiles#get_compinfo_by_name title in
113113
let finfo = List.hd cinfo.bcfields in
114114
let aas = push_field_pos aas_start_state finfo in
115-
let (locs, naas) = get_arm_struct_field_locations finfo aas in
115+
let (locs, _naas) = get_arm_struct_field_locations finfo aas in
116116
let xlocs = [
117117
mk_register_parameter_location
118118
~position:[mk_field_position cinfo.bckey 0 (get_struct_field_name finfo)]
@@ -140,7 +140,7 @@ let get_arm_struct_param_next_state_test () =
140140
let cinfo = bcfiles#get_compinfo_by_name title in
141141
let btype = get_compinfo_struct_type cinfo in
142142
let size = CHTraceResult.tget_ok (size_of_btype btype) in
143-
let (param, naas) =
143+
let (param, _naas) =
144144
get_arm_struct_param_next_state
145145
size "arg_1" btype aas_start_state 1 in
146146
let xlocs =

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHFlocTest.ml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,12 @@
2828

2929
(* chlib *)
3030
open CHNumerical
31-
open CHPretty
32-
33-
(* chutil *)
34-
open CHLogger
35-
open CHPrettyUtil
3631

3732
(* xprlib *)
3833
open Xprt
39-
open XprToPretty
4034
open XprTypes
4135

4236
(* bchlib *)
43-
open BCHBasicTypes
4437
open BCHBCFiles
4538
open BCHBCTypes
4639
open BCHConstantDefinitions
@@ -49,7 +42,6 @@ open BCHFloc
4942
open BCHFunctionData
5043
open BCHFunctionInfo
5144
open BCHLibTypes
52-
open BCHMemoryReference
5345

5446
(* bchcil *)
5547
open BCHParseCilFile
@@ -63,11 +55,6 @@ let testname = "bCHFlocTest"
6355
let lastupdated = "2024-08-20"
6456

6557

66-
let x2p = xpr_formatter#pr_expr
67-
let p2s = pretty_to_string
68-
let x2s x = p2s (x2p x)
69-
70-
7158
let decompose_memvar_address_test () =
7259
let faddr = "0x1d6bfc" in
7360
let iaddr = "0x1d6cbc" in

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHFunctionInterfaceTest.ml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
------------------------------------------------------------------------------
66
The MIT License (MIT)
77
8-
Copyright (c) 2023 Aarno Labs LLC
8+
Copyright (c) 2023-2024 Aarno Labs LLC
99
1010
Permission is hereby granted, free of charge, to any person obtaining a copy
1111
of this software and associated documentation files (the "Software"), to deal
@@ -35,10 +35,6 @@
3535

3636
(* chlib *)
3737
open CHPretty
38-
open CHNumerical
39-
40-
(* tchblib *)
41-
open TCHSpecification
4238

4339
(* bchlib *)
4440
open BCHBasicTypes
@@ -181,7 +177,7 @@ let function_signature_of_bvarinfo_arm () =
181177
else
182178
raise
183179
(BCH_failure (LBLOCK [STR title; STR " not found"])) in
184-
let (xresult, fintf, tsig) =
180+
let (xresult, _fintf, tsig) =
185181
try
186182
let xresult = List.map BU.convert_fts_parameter_input result in
187183
let fintf = FI.bvarinfo_to_function_interface bvinfo in

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHMemoryReferenceTest.ml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,13 @@
2828

2929
(* chlib *)
3030
open CHNumerical
31-
open CHPretty
32-
33-
(* chutil *)
34-
open CHLogger
35-
open CHPrettyUtil
36-
37-
(* xprlib *)
38-
open Xprt
39-
open XprToPretty
40-
open XprTypes
4131

4232
(* bchlib *)
43-
open BCHBasicTypes
4433
open BCHBCFiles
4534
open BCHBCTypes
4635
open BCHConstantDefinitions
4736
open BCHDoubleword
48-
open BCHFloc
4937
open BCHFunctionData
50-
open BCHFunctionInfo
5138
open BCHLibTypes
5239

5340
(* bchcil *)
@@ -65,11 +52,6 @@ let testname = "bCHMemoryReferenceTest"
6552
let lastupdated = "2024-08-21"
6653

6754

68-
let x2p = xpr_formatter#pr_expr
69-
let p2s = pretty_to_string
70-
let x2s x = p2s (x2p x)
71-
72-
7355
let mk_maximal_memory_offset_test () =
7456
begin
7557

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHTypeConstraintStoreTest.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ open CHPretty
3636
(* bchlib *)
3737
open BCHBasicTypes
3838
open BCHBCFiles
39-
open BCHBCTypePretty
40-
open BCHCPURegisters
4139
open BCHFunctionInterface
4240
open BCHLibTypes
4341
open BCHSystemSettings

CodeHawk/CHT/CHB_tests/bchlib_tests/txbchlib/bCHXprUtilTest.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@
2828

2929
(* chlib *)
3030
open CHNumerical
31-
open CHPretty
32-
33-
(* chutil *)
34-
open CHPrettyUtil
3531

3632
(* xprlib *)
37-
open Xprt
38-
open XprToPretty
3933
open XprTypes
4034
open Xsimplify
4135

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
(tests
2-
(names bCHDoublewordTest bCHImmediateTest bCHLocationTest bCHStreamWrapperTest)
3-
(libraries bchlib chlib chutil tbchlib tchlib))
1+
(tests
2+
(names
3+
bCHDoublewordTest
4+
bCHImmediateTest
5+
bCHLocationTest
6+
bCHStreamWrapperTest
7+
bCHXprUtilTest
8+
bCHMemoryReferenceTest
9+
bCHFunctionInterfaceTest
10+
bCHARMFunctionInterfaceTest
11+
bCHTypeConstraintStoreTest
12+
bCHFlocTest)
13+
(deps header.i decompose_array_address.i)
14+
(libraries bchcil bchlib xprlib chlib chutil tbchlib tchlib txprlib))

CodeHawk/CHT/CHB_tests/bchlibarm32_tests/tbchlibarm32/tCHBchlibarm32Utils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ let thumb_function_setup
125125
| _ -> ()
126126
done;
127127
let _ = set_block_boundaries () in
128-
let _ = construct_functions_arm ~construct_all_functions:false in
128+
let _ = construct_functions_arm ~construct_all_functions:false () in
129129
get_arm_assembly_function faddr
130130
end
131131

CodeHawk/CHT/CHB_tests/bchlibelf_tests/txbchlibelf/bCHDwarfTest.ml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
------------------------------------------------------------------------------
66
The MIT License (MIT)
77
8-
Copyright (c) 2023 Aarno Labs LLC
8+
Copyright (c) 2023-2024 Aarno Labs LLC
99
1010
Permission is hereby granted, free of charge, to any person obtaining a copy
1111
of this software and associated documentation files (the "Software"), to deal
@@ -26,25 +26,15 @@
2626
SOFTWARE.
2727
============================================================================= *)
2828

29-
(* chlib *)
30-
open CHPretty
31-
32-
(* chutil *)
33-
open CHXmlDocument
34-
open CHXmlReader
35-
3629
(* bchlib *)
37-
open BCHBasicTypes
3830
open BCHDoubleword
39-
open BCHLibTypes
4031
open BCHStreamWrapper
4132

4233
(* bchlibelf *)
4334
open BCHDwarf
4435
open BCHDwarfTypes
4536
open BCHDwarfUtils
4637
open BCHELFDebugAbbrevSection
47-
open BCHELFTypes
4838
open BCHELFSectionHeader
4939

5040
(* tchlib *)
@@ -169,7 +159,7 @@ let decode_variable_die_test () =
169159
let sh = mk_elf_section_header () in
170160
let section = mk_elf_debug_abbrev_section astring sh in
171161
let abbreventry = section#get_abbrev_entry in
172-
let fabbrev = fun (i: int) -> abbreventry in
162+
let fabbrev = fun (_i: int) -> abbreventry in
173163
let chi = make_pushback_stream ~little_endian:true istring in
174164
let base = TR.tget_ok (string_to_doubleword base) in
175165
let var =

0 commit comments

Comments
 (0)