Skip to content

Commit

Permalink
Lean: ignore unused variables (#1013)
Browse files Browse the repository at this point in the history
This reduces the number of warnings+errors from 3021 to 1562 on the RISC-V
spec. This closes #1011.

Co-authored-by: Léo Stefanesco <[email protected]>
  • Loading branch information
tobiasgrosser and ineol authored Feb 16, 2025
1 parent 6ae1f3d commit ecfe107
Show file tree
Hide file tree
Showing 29 changed files with 115 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sail_lean_backend/sail_plugin_lean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ let start_lean_output (out_name : string) default_sail_dir =
let main_file = open_out (Filename.concat project_dir (out_name_camel ^ ".lean")) in
output_string main_file ("import " ^ out_name_camel ^ ".Sail.Sail\n");
output_string main_file ("import " ^ out_name_camel ^ ".Sail.BitVec\n\n");
output_string main_file "set_option maxHeartbeats 1_000_000_000\n";
output_string main_file "set_option maxRecDepth 10_000\n";
output_string main_file "set_option linter.unusedVariables false\n\n";
output_string main_file "open Sail\n\n";
let lakefile = open_out (Filename.concat project_dir "lakefile.toml") in
{ out_name; out_name_camel; sail_dir; main_file; lakefile }
Expand Down
4 changes: 4 additions & 0 deletions test/lean/SailTinyArm.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/atom_bool.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev SailM := PreSailM PEmpty.elim trivialChoiceSource Unit
Expand Down
4 changes: 4 additions & 0 deletions test/lean/bitfield.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/bitvec_operation.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/enum.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/errors.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/extern.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/extern_bitvec.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/implicit.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/ite.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/let.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/loop.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/mapping.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/match.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/match_bv.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/option.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/range.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/register_vector.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/registers.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/struct.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/struct_of_enum.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/trivial.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev SailM := PreSailM PEmpty.elim trivialChoiceSource Unit
Expand Down
4 changes: 4 additions & 0 deletions test/lean/tuples.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev SailM := PreSailM PEmpty.elim trivialChoiceSource Unit
Expand Down
4 changes: 4 additions & 0 deletions test/lean/type_kid.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev SailM := PreSailM PEmpty.elim trivialChoiceSource Unit
Expand Down
4 changes: 4 additions & 0 deletions test/lean/typedef.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/typquant.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev bits k_n := (BitVec k_n)
Expand Down
4 changes: 4 additions & 0 deletions test/lean/undefined.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail

abbrev SailM := PreSailM PEmpty.elim trivialChoiceSource Unit
Expand Down
4 changes: 4 additions & 0 deletions test/lean/union.expected.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Out.Sail.Sail
import Out.Sail.BitVec

set_option maxHeartbeats 1_000_000_000
set_option maxRecDepth 10_000
set_option linter.unusedVariables false

open Sail


Expand Down

0 comments on commit ecfe107

Please sign in to comment.