···590590 files; module-name candidates are derived from the library name plus
591591 its dune [(name ...)] internal alias when one exists. *)
592592593593+(** Libraries that exist only for link-time or setup side-effects: CLI
594594+ output styling, OS-specific clocks, C stubs registered via the runtime,
595595+ and similar. They are routinely declared in [(libraries ...)] without
596596+ ever opening a module, so the textual Dead_lib check always flags them
597597+ as false positives. *)
598598+let is_setup_only_sublib lib =
599599+ match lib with
600600+ | "fmt.tty" | "fmt.cli" | "fmt.top" | "logs.cli" | "logs.fmt"
601601+ | "logs.threaded" | "eio.runtime_events" | "eio.unix" | "eio_main"
602602+ | "ptime.clock.os" | "ptime.clock.jsoo" | "wire.stubs" | "wire.3d"
603603+ | "dune-build-info" | "dune-configurator" | "nox-crypto.ocaml" ->
604604+ true
605605+ | _ -> false
606606+593607let dead_libs_in_subtree ~fs ~public_to_internal ~archive_modules ~subtree
594608 subtree_path =
595609 let dune_files = dune_files_in ~fs subtree_path in
···608622 let libs = libs_of_fields fields in
609623 List.filter_map
610624 (fun lib ->
611611- if is_builtin lib then None
625625+ if is_builtin lib || is_setup_only_sublib lib then None
612626 else
613627 let candidates =
614628 module_candidates ~public_to_internal