Skip to content

Commit e098c05

Browse files
authored
Merge pull request #526 from FStarLang/protz_fix_build
Fix case of constants, and hide debug info
2 parents 5e12cec + 0892618 commit e098c05

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

lib/Bundles.ml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ let direct_dependencies_with_internal files file_of =
283283
match file_of callee with
284284
| Some f when f <> fst file && not (Helpers.is_primitive callee) ->
285285
let is_internal = LidSet.mem callee internal in
286-
KPrint.bprintf "In file %s, reference to %a (in %sheader %s)\n"
287-
(fst file) PrintAst.plid callee (if is_internal then "internal " else "") f;
286+
if Options.debug "dependencies" then
287+
KPrint.bprintf "In file %s, reference to %a (in %sheader %s)\n"
288+
(fst file) PrintAst.plid callee (if is_internal then "internal " else "") f;
288289
if is_internal then
289290
{ empty_deps with internal = StringSet.singleton f }
290291
else
@@ -293,16 +294,16 @@ let direct_dependencies_with_internal files file_of =
293294
empty_deps
294295
in
295296
let is_inline_static lid = List.exists (fun p -> Bundle.pattern_matches_lid p lid) !Options.static_header in
296-
let header_deps which = object
297+
let header_deps which = object(self)
297298
inherit (record_everything gen_dep) as super
298299

300+
method private concerns_us flags =
301+
match which with
302+
| `Public -> not (List.mem Common.Internal flags) && not (List.mem Common.Private flags)
303+
| `Internal -> List.mem Common.Internal flags
304+
299305
method! visit_DFunction env cc flags n_cgs n ret name binders body =
300-
let concerns_us =
301-
match which with
302-
| `Public -> not (List.mem Common.Internal flags) && not (List.mem Common.Private flags)
303-
| `Internal -> List.mem Common.Internal flags
304-
in
305-
if concerns_us then
306+
if self#concerns_us flags then
306307
if is_inline_static name then
307308
super#visit_DFunction env cc flags n_cgs n ret name binders body
308309
else
@@ -312,24 +313,37 @@ let direct_dependencies_with_internal files file_of =
312313
super#zero
313314

314315
method! visit_DType env name flags n_cgs n def =
315-
let concerns_us =
316-
match which with
317-
| `Public -> not (List.mem Common.Internal flags) && not (List.mem Common.Private flags)
318-
| `Internal -> List.mem Common.Internal flags
319-
in
320316
let is_c_abstract_struct = List.mem Common.AbstractStruct flags in
321-
if concerns_us then
317+
if self#concerns_us flags then
322318
if is_c_abstract_struct then
323319
super#visit_DType env name flags n_cgs n (Abbrev TUnit)
324320
else
325321
super#visit_DType env name flags n_cgs n def
326322
else
327323
super#zero
324+
325+
method! visit_DGlobal env flags name n t body =
326+
if self#concerns_us flags then
327+
if is_inline_static name then
328+
super#visit_DGlobal env flags name n t body
329+
else
330+
super#visit_DGlobal env flags name n t Helpers.eunit
331+
else
332+
super#zero
328333
end in
329334
let deps = {
330-
h = (KPrint.bprintf "PUBLIC %s\n" (fst file); header_deps `Public)#visit_file () file;
331-
internal_h = (KPrint.bprintf "INTERNAL %s\n" (fst file); header_deps `Internal)#visit_file () file;
332-
c = (KPrint.bprintf "C %s\n" (fst file); new record_everything gen_dep)#visit_file () file;
335+
h = (
336+
if Options.debug "dependencies" then
337+
KPrint.bprintf "PUBLIC %s\n" (fst file);
338+
(header_deps `Public)#visit_file () file);
339+
internal_h = (
340+
if Options.debug "dependencies" then
341+
KPrint.bprintf "INTERNAL %s\n" (fst file);
342+
(header_deps `Internal)#visit_file () file);
343+
c = (
344+
if Options.debug "dependencies" then
345+
KPrint.bprintf "C %s\n" (fst file);
346+
(new record_everything gen_dep)#visit_file () file);
333347
} in
334348

335349
if not (StringSet.is_empty deps.h.internal) then

0 commit comments

Comments
 (0)