Skip to content

Commit a823b28

Browse files
committed
Extraction: reduce krml output unless -d/--debug
Karamel extraction prints many warnings when definitions cannot be extracted, but most of these are benign, since they are just types, or ghost code, etc. This patch disables these warnings unless some debugging is enabled.
1 parent 34744ec commit a823b28

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/extraction/FStar.Extraction.Krml.fst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,8 @@ let translate_type_decl' env ty: option decl =
13311331
Some (DTypeAbstractStruct name)
13321332
else if assumed then
13331333
let name = string_of_mlpath name in
1334-
BU.print1_warning "Not extracting type definition %s to KaRaMeL (assumed type)\n" name;
1334+
if Debug.any () then
1335+
BU.print1_warning "Not extracting type definition %s to KaRaMeL (assumed type)\n" name;
13351336
// JP: TODO: shall we be smarter here?
13361337
None
13371338
else
@@ -1381,7 +1382,8 @@ let translate_let' env flavor lb: option decl =
13811382
if List.length tvars = 0 then
13821383
Some (DExternal (translate_cc meta, translate_flags meta, name, translate_type env t0, arg_names))
13831384
else begin
1384-
BU.print1_warning "Not extracting %s to KaRaMeL (polymorphic assumes are not supported)\n" (Syntax.string_of_mlpath name);
1385+
if Debug.any () then
1386+
BU.print1_warning "Not extracting %s to KaRaMeL (polymorphic assumes are not supported)\n" (Syntax.string_of_mlpath name);
13851387
None
13861388
end
13871389

@@ -1405,7 +1407,7 @@ let translate_let' env flavor lb: option decl =
14051407
in
14061408
let name = env.module_name, name in
14071409
let i, eff, t = find_return_type E_PURE (List.length args) t0 in
1408-
if i > 0 then begin
1410+
if i > 0 && Debug.any () then begin
14091411
let msg = "function type annotation has less arrows than the \
14101412
number of arguments; please mark the return type abbreviation as \
14111413
inline_for_extraction" in
@@ -1509,7 +1511,8 @@ let translate_decl env d: list decl =
15091511
failwith "todo: translate_decl [MLM_Top]"
15101512

15111513
| MLM_Exn (m, _) ->
1512-
BU.print1_warning "Not extracting exception %s to KaRaMeL (exceptions unsupported)\n" m;
1514+
if Debug.any () then
1515+
BU.print1_warning "Not extracting exception %s to KaRaMeL (exceptions unsupported)\n" m;
15131516
[]
15141517

15151518
let translate_module uenv (m : mlpath & option (mlsig & mlmodule) & mllib) : file =

0 commit comments

Comments
 (0)