diff --git a/CHANGES.md b/CHANGES.md index 9d34eae5b8f..e35f1565c6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,12 @@ Introducing a new `external_variant` stanza. (#2169, fixes #2134, @TheLortex, review by @diml) +- Add proper line directives when copying `.cc` and `.cxx` sources (#2275, + @rgrinberg) + +- Fix error message for missing C++ sources. The `.cc` extension was always + ignored before. (#2275, @rgrinberg) + 1.10.0 (04/06/2019) ------------------- diff --git a/bin/import.ml b/bin/import.ml index ac6b787a1dd..82b0b0d65c2 100644 --- a/bin/import.ml +++ b/bin/import.ml @@ -23,7 +23,7 @@ module Build = Dune.Build module Action = Dune.Action module Dep = Dune.Dep module Action_to_sh = Dune.Action_to_sh -module Path_dune_lang = Dune.Path_dune_lang +module Dpath = Dune.Dpath module Install = Dune.Install module Watermarks = Dune.Watermarks module Promotion = Dune.Promotion diff --git a/bin/print_rules.ml b/bin/print_rules.ml index 9305d237261..ac0bcf5ab39 100644 --- a/bin/print_rules.ml +++ b/bin/print_rules.ml @@ -47,7 +47,7 @@ let print_rule_sexp ppf (rule : Build_system.Rule.t) = Action.for_shell action |> Action.For_shell.encode in let paths ps = - Dune_lang.Encoder.list Path_dune_lang.encode (Path.Set.to_list ps) + Dune_lang.Encoder.list Dpath.encode (Path.Set.to_list ps) in let sexp = Dune_lang.Encoder.record ( diff --git a/src/action.ml b/src/action.ml index ed538564ae6..97c9f5198ab 100644 --- a/src/action.ml +++ b/src/action.ml @@ -72,10 +72,10 @@ module Prog = struct type t = (Path.t, Not_found.t) result let decode : t Dune_lang.Decoder.t = - Dune_lang.Decoder.map Path_dune_lang.decode ~f:Result.ok + Dune_lang.Decoder.map Dpath.decode ~f:Result.ok let encode = function - | Ok s -> Path_dune_lang.encode s + | Ok s -> Dpath.encode s | Error (e : Not_found.t) -> Dune_lang.Encoder.string e.program end @@ -91,7 +91,7 @@ module String_with_sexp = struct let encode = Dune_lang.Encoder.string end -include Action_ast.Make(Prog)(Path_dune_lang)(String_with_sexp)(Ast) +include Action_ast.Make(Prog)(Dpath)(String_with_sexp)(Ast) type program = Prog.t type path = Path.t type string = String.t diff --git a/src/action_unexpanded.ml b/src/action_unexpanded.ml index 67207b35b4f..c9b5838e886 100644 --- a/src/action_unexpanded.ml +++ b/src/action_unexpanded.ml @@ -23,7 +23,7 @@ let check_mkdir loc path = "(mkdir ...) is not supported for paths outside of the workspace:\n\ \ %a\n" (Dune_lang.pp Dune) - (List [Dune_lang.unsafe_atom_of_string "mkdir"; Path_dune_lang.encode path]) + (List [Dune_lang.unsafe_atom_of_string "mkdir"; Dpath.encode path]) module Partial = struct module Program = Unresolved.Program diff --git a/src/alias.ml b/src/alias.ml index 2a7df86b967..7f613fbc4e4 100644 --- a/src/alias.ml +++ b/src/alias.ml @@ -101,6 +101,6 @@ let fmt = make_standard "fmt" let encode { dir ; name } = let open Dune_lang.Encoder in record - [ "dir", Path_dune_lang.encode (Path.build dir) + [ "dir", Dpath.encode (Path.build dir) ; "name", string name ] diff --git a/src/build_system.ml b/src/build_system.ml index df5323b2f9e..b61109f2898 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -589,9 +589,9 @@ let remove_old_artifacts t ~dir ~(subdirs_to_keep : Subdir_set.t) = let no_rule_found = fun t ~loc fn -> let fail fn ~loc = - Errors.fail_opt loc "No rule found for %s" (Utils.describe_target fn) + Errors.fail_opt loc "No rule found for %s" (Dpath.describe_target fn) in - match Utils.analyse_target fn with + match Dpath.analyse_target fn with | Other _ -> fail fn ~loc | Regular (ctx, _) -> if String.Map.mem t.contexts ctx then @@ -930,7 +930,7 @@ The following targets are not: let corresponding_source_dir ~dir = let t = t () in - match Utils.analyse_target dir with + match Dpath.analyse_target dir with | Install _ | Alias _ | Other _ -> None | Regular (_ctx, sub_dir) -> @@ -982,7 +982,7 @@ The following targets are not: let load_dir_step2_exn t ~dir = let context_name, sub_dir = - match Utils.analyse_path dir with + match Dpath.analyse_path dir with | Build (Install (ctx, path)) -> Context_or_install.Install ctx, path | Build (Regular (ctx, path)) -> @@ -1576,7 +1576,7 @@ end = struct ~output:(Allow_cutoff (module Unit)) ~doc:"Build a file." ~input:(module Path) - ~visibility:(Public Path_dune_lang.decode) + ~visibility:(Public Dpath.decode) Async build_file_impl diff --git a/src/c.ml b/src/c.ml index b85bb677640..16be2879d34 100644 --- a/src/c.ml +++ b/src/c.ml @@ -1,5 +1,7 @@ open Stdune +let header_ext = ".h" + module Kind = struct type t = | C @@ -32,17 +34,24 @@ module Kind = struct cxx_version_introduced ~obj ~dune_version ~version_introduced:(1, 10) | _ -> Unrecognized - let possible_fns t fn ~dune_version = - match t with - | C -> [fn ^ ".c"] + let possible_exts ~dune_version = function + | C -> [".c"] | Cxx -> - let cxx = [fn ^ ".cpp"] in + let exts = [".cpp"] in + let exts = + if dune_version >= (1, 10) then + ".cc" :: exts + else + exts + in if dune_version >= (1, 8) then - (fn ^ ".cxx") :: cxx - else if dune_version >= (1, 10) then - (fn ^ ".cxx") :: (fn ^ ".cc") :: cxx + ".cxx" :: exts else - cxx + exts + + let possible_fns t fn ~dune_version = + possible_exts t ~dune_version + |> List.map ~f:(fun ext -> fn ^ ext) module Dict = struct type 'a t = @@ -122,3 +131,11 @@ module Sources = struct in {Kind.Dict. c; cxx} end + +let all_possible_exts = + let exts = Kind.possible_exts ~dune_version:Stanza.latest_version in + header_ext :: exts C @ exts Cxx + +let c_cxx_or_header ~fn = + let ext = Filename.extension fn in + List.mem ~set:all_possible_exts ext diff --git a/src/c.mli b/src/c.mli index 26c702ea30e..6e15c733a22 100644 --- a/src/c.mli +++ b/src/c.mli @@ -1,5 +1,7 @@ open Stdune +val header_ext : string + module Kind : sig type t = | C @@ -65,3 +67,5 @@ module Sources : sig val split_by_kind : t -> t Kind.Dict.t end + +val c_cxx_or_header : fn:string -> bool diff --git a/src/dep.ml b/src/dep.ml index ae3c32fe6ae..fe1bf868147 100644 --- a/src/dep.ml +++ b/src/dep.ml @@ -68,7 +68,7 @@ module T = struct match t with | Glob g -> pair string File_selector.encode ("glob", g) | Env e -> pair string string ("Env", e) - | File f -> pair string Path_dune_lang.encode ("File", f) + | File f -> pair string Dpath.encode ("File", f) | Alias a -> pair string Alias.encode ("Alias", a) | Universe -> string "Universe" end diff --git a/src/dep_path.ml b/src/dep_path.ml index c6a2da1d91c..6cee8f1a8dc 100644 --- a/src/dep_path.ml +++ b/src/dep_path.ml @@ -10,8 +10,8 @@ module Entry = struct | Loc of Loc.t let pp = function - | Path p -> Pp.text (Utils.describe_path p) - | Alias p -> Pp.textf "alias %s" (Utils.describe_path p) + | Path p -> Pp.text (Dpath.describe_path p) + | Alias p -> Pp.textf "alias %s" (Dpath.describe_path p) | Library (path, lib_name) -> Pp.textf "library %S in %s" (Lib_name.to_string lib_name) diff --git a/src/dpath.ml b/src/dpath.ml new file mode 100644 index 00000000000..bdcbfa58811 --- /dev/null +++ b/src/dpath.ml @@ -0,0 +1,114 @@ +open Stdune + +type target_kind = + | Regular of string * Path.Source.t + | Alias of string * Path.Source.t + | Install of string * Path.Source.t + | Other of Path.Build.t + +type path_kind = + | Source of Path.Source.t + | External of Path.External.t + | Build of target_kind + +let analyse_target (fn as original_fn) : target_kind = + match Path.Build.extract_first_component fn with + | Some (".aliases", sub) -> + (match Path.Local.split_first_component sub with + | None -> Other fn + | Some (ctx, fn) -> + if Path.Local.is_root fn then + Other original_fn + else + let basename = + match String.rsplit2 (Path.Local.basename fn) ~on:'-' with + | None -> assert false + | Some (name, digest) -> + assert (String.length digest = 32); + name + in + Alias (ctx, + Path.Source.relative + (Path.Source.of_local (Path.Local.parent_exn fn)) + basename)) + | Some ("install", sub) -> + (match Path.Local.split_first_component sub with + | None -> Other fn + | Some (ctx, fn) -> + Install (ctx, Path.Source.of_local fn)) + | Some (ctx, sub) -> + Regular (ctx, Path.Source.of_local sub) + | None -> + Other fn + +let describe_target fn = + let ctx_suffix = function + | "default" -> "" + | ctx -> sprintf " (context %s)" ctx + in + match analyse_target fn with + | Alias (ctx, p) -> + sprintf "alias %s%s" (Path.Source.to_string_maybe_quoted p) (ctx_suffix ctx) + | Install (ctx, p) -> + sprintf "install %s%s" (Path.Source.to_string_maybe_quoted p) (ctx_suffix ctx) + | Regular (ctx, fn) -> + sprintf "%s%s" (Path.Source.to_string_maybe_quoted fn) (ctx_suffix ctx) + | Other fn -> + Path.Build.to_string_maybe_quoted fn + +let describe_path (p : Path.t) = + match p with + | External _ | In_source_tree _ -> + Path.to_string_maybe_quoted p + | In_build_dir p -> describe_target p + +let analyse_path (fn : Path.t) = match fn with + | In_source_tree src -> Source src + | External e -> External e + | In_build_dir build -> Build (analyse_target build) + +type t = Path.t + +let encode p = + let make constr arg = + Dune_lang.List [ + Dune_lang.atom constr + ; Dune_lang.atom_or_quoted_string arg + ] + in + let open Path in + match p with + | In_build_dir p -> + make "In_build_dir" (Path.Build.to_string p) + | In_source_tree p -> + make "In_source_tree" (Path.Source.to_string p) + | External p -> + make "External" (Path.External.to_string p) + +let decode = + let open Dune_lang.Decoder in + let external_ = + plain_string (fun ~loc t -> + if Filename.is_relative t then + Dune_lang.Decoder.of_sexp_errorf loc "Absolute path expected" + else + Path.parse_string_exn ~loc t + ) + in + sum + [ "In_build_dir" , string >>| Path.(relative build_dir) + ; "In_source_tree", string >>| Path.(relative root) + ; "External" , external_ + ] + +module Local = struct + let encode ~dir:from p = + let open Dune_lang.Encoder in + string (Path.reach ~from p) + + let decode ~dir = + let open Dune_lang.Decoder in + let+ (error_loc, path) = located string + in + Path.relative ~error_loc dir path +end diff --git a/src/dpath.mli b/src/dpath.mli new file mode 100644 index 00000000000..2b4884341e1 --- /dev/null +++ b/src/dpath.mli @@ -0,0 +1,28 @@ +open Stdune + +type target_kind = + | Regular of string (* build context *) * Path.Source.t + | Alias of string (* build context *) * Path.Source.t + | Install of string (* build context *) * Path.Source.t + | Other of Path.Build.t + +type path_kind = + | Source of Path.Source.t + | External of Path.External.t + | Build of target_kind + +(** Return the name of an alias from its stamp file *) +val analyse_target : Path.Build.t -> target_kind +val analyse_path : Path.t -> path_kind + +(** Nice description of a target *) +val describe_target : Path.Build.t -> string +val describe_path : Path.t -> string + +include Dune_lang.Conv with type t = Path.t + +module Local : sig + val encode : dir:Path.t -> Path.t Dune_lang.Encoder.t + + val decode : dir:Path.t -> Path.t Dune_lang.Decoder.t +end diff --git a/src/dune_package.ml b/src/dune_package.ml index 31b591f4c1e..5ffaa3430e9 100644 --- a/src/dune_package.ml +++ b/src/dune_package.ml @@ -92,7 +92,7 @@ module Lib = struct } = let open Dune_lang.Encoder in let no_loc f (_loc, x) = f x in - let path = Path_dune_lang.Local.encode ~dir:package_root in + let path = Dpath.Local.encode ~dir:package_root in let paths name f = field_l name path f in let mode_paths name (xs : Path.t Mode.Dict.List.t) = field_l name sexp (Mode.Dict.List.encode path xs) in @@ -131,7 +131,7 @@ module Lib = struct let decode ~base = let open Stanza.Decoder in - let path = Path_dune_lang.Local.decode ~dir:base in + let path = Dpath.Local.decode ~dir:base in let field_l s x = field ~default:[] s (list x) in let libs s = field_l s (located Lib_name.decode) in let paths s = field_l s path in diff --git a/src/dune_package.mli b/src/dune_package.mli index f52dccbe24a..20ec32b1ec6 100644 --- a/src/dune_package.mli +++ b/src/dune_package.mli @@ -83,5 +83,5 @@ module Or_meta : sig -> (Syntax.Version.t * Dune_lang.t list) t -> Dune_lang.t list - val load : Path_dune_lang.t -> Sub_system_info.t t + val load : Dpath.t -> Sub_system_info.t t end diff --git a/src/file_selector.ml b/src/file_selector.ml index 82047021756..87dd7238028 100644 --- a/src/file_selector.ml +++ b/src/file_selector.ml @@ -26,7 +26,7 @@ let pp fmt t = Dyn.pp fmt (to_dyn t) let encode { dir; predicate } = let open Dune_lang.Encoder in record - [ "dir", Path_dune_lang.encode dir + [ "dir", Dpath.encode dir ; "predicate", Predicate.encode predicate ] diff --git a/src/lib_archives.ml b/src/lib_archives.ml index e532474a53d..c3027cee294 100644 --- a/src/lib_archives.ml +++ b/src/lib_archives.ml @@ -20,7 +20,7 @@ let make ~(ctx : Context.t) ~dir ~dir_contents (lib : Library.t) = let virtual_library = Library.is_virtual lib in List.concat [ if_ (byte && not virtual_library) - [ Library.archive ~dir lib ~ext:".cma" ] + [ Library.archive ~dir lib ~ext:(Mode.compiled_lib_ext Byte) ] ; if virtual_library then ( let files = Dir_contents.c_sources_of_library dir_contents @@ -33,18 +33,18 @@ let make ~(ctx : Context.t) ~dir ~dir_contents (lib : Library.t) = [] ; if_ (native && not virtual_library) (let files = - [ Library.archive ~dir lib ~ext:".cmxa" + [ Library.archive ~dir lib ~ext:(Mode.compiled_lib_ext Native) ; Library.archive ~dir lib ~ext:ctx.ext_lib ] in if Dynlink_supported.get lib.dynlink ctx.natdynlink_supported then - files @ [ Library.archive ~dir lib ~ext:".cmxs" ] + files @ [ Library.archive ~dir lib ~ext:(Mode.plugin_ext Native) ] else files) ; List.map lib.buildable.js_of_ocaml.javascript_files ~f:(Path.Build.relative dir) ; List.map lib.install_c_headers ~f:(fun fn -> - Path.Build.relative dir (fn ^ ".h")) + Path.Build.relative dir (fn ^ C.header_ext)) ] in let dlls = diff --git a/src/lib_file_deps.ml b/src/lib_file_deps.ml index 565fe9b12fb..c323d748fe3 100644 --- a/src/lib_file_deps.ml +++ b/src/lib_file_deps.ml @@ -11,7 +11,7 @@ module Group = struct let ext = function | Cmi -> Cm_kind.ext Cmi | Cmx -> Cm_kind.ext Cmx - | Header -> ".h" + | Header -> C.header_ext let obj_dir t obj_dir = match t with diff --git a/src/lib_rules.ml b/src/lib_rules.ml index 62d804e99e5..e590f9b0650 100644 --- a/src/lib_rules.ml +++ b/src/lib_rules.ml @@ -248,7 +248,7 @@ module Gen (P : sig val sctx : Super_context.t end) = struct List.fold_left all_dirs ~init:[] ~f:(fun acc dc -> String.Set.fold (Dir_contents.text_files dc) ~init:acc ~f:(fun fn acc -> - if String.is_suffix fn ~suffix:".h" then + if String.is_suffix fn ~suffix:C.header_ext then Path.relative (Path.build (Dir_contents.dir dc)) fn :: acc else acc)) diff --git a/src/meta.ml b/src/meta.ml index 5d30d403fb8..87790d59343 100644 --- a/src/meta.ml +++ b/src/meta.ml @@ -189,10 +189,10 @@ let directory s = rule "directory" [] Set s let archive p s = rule "archive" [Pos p] Set s let plugin p s = rule "plugin" [Pos p] Set s let archives name = - [ archive "byte" (name ^ ".cma" ) - ; archive "native" (name ^ ".cmxa") - ; plugin "byte" (name ^ ".cma" ) - ; plugin "native" (name ^ ".cmxs") + [ archive "byte" (name ^ (Mode.compiled_lib_ext Byte)) + ; archive "native" (name ^ (Mode.compiled_lib_ext Native)) + ; plugin "byte" (name ^ (Mode.compiled_lib_ext Byte)) + ; plugin "native" (name ^ (Mode.plugin_ext Native)) ] let builtins ~stdlib_dir ~version:ocaml_version = diff --git a/src/path_dune_lang.ml b/src/path_dune_lang.ml deleted file mode 100644 index 95cefa106d0..00000000000 --- a/src/path_dune_lang.ml +++ /dev/null @@ -1,47 +0,0 @@ -open Stdune -open Path - -type t = Path.t - -let encode p = - let make constr arg = - Dune_lang.List [ - Dune_lang.atom constr - ; Dune_lang.atom_or_quoted_string arg - ] - in - match p with - | In_build_dir p -> - make "In_build_dir" (Path.Build.to_string p) - | In_source_tree p -> - make "In_source_tree" (Path.Source.to_string p) - | External p -> - make "External" (Path.External.to_string p) - -let decode = - let open Dune_lang.Decoder in - let external_ = - plain_string (fun ~loc t -> - if Filename.is_relative t then - Dune_lang.Decoder.of_sexp_errorf loc "Absolute path expected" - else - Path.parse_string_exn ~loc t - ) - in - sum - [ "In_build_dir" , string >>| Path.(relative build_dir) - ; "In_source_tree", string >>| Path.(relative root) - ; "External" , external_ - ] - -module Local = struct - let encode ~dir:from p = - let open Dune_lang.Encoder in - string (Path.reach ~from p) - - let decode ~dir = - let open Dune_lang.Decoder in - let+ (error_loc, path) = located string - in - Path.relative ~error_loc dir path -end diff --git a/src/path_dune_lang.mli b/src/path_dune_lang.mli deleted file mode 100644 index 7a7d4a01768..00000000000 --- a/src/path_dune_lang.mli +++ /dev/null @@ -1,9 +0,0 @@ -open Stdune - -include Dune_lang.Conv with type t = Path.t - -module Local : sig - val encode : dir:Path.t -> Path.t Dune_lang.Encoder.t - - val decode : dir:Path.t -> Path.t Dune_lang.Decoder.t -end diff --git a/src/process.ml b/src/process.ml index 08d30727f38..3067aca2965 100644 --- a/src/process.ml +++ b/src/process.ml @@ -195,7 +195,7 @@ module Fancy = struct | [] -> List.rev targets_acc, String.Set.(to_list (of_list ctxs_acc)) | path :: rest -> let add_ctx ctx acc = if ctx = "default" then acc else ctx :: acc in - match Utils.analyse_target path with + match Dpath.analyse_target path with | Other path -> split_paths (Path.Build.to_string path :: targets_acc) ctxs_acc rest | Regular (ctx, filename) -> diff --git a/src/stanza.ml b/src/stanza.ml index f8f10a74bfd..acae95d2db0 100644 --- a/src/stanza.ml +++ b/src/stanza.ml @@ -6,10 +6,12 @@ module Parser = struct type nonrec t = string * t list Dune_lang.Decoder.t end +let latest_version = (1, 10) + let syntax = Syntax.create ~name:"dune" ~desc:"the dune language" [ (0, 0) (* Jbuild syntax *) - ; (1, 10) + ; latest_version ] module File_kind = struct diff --git a/src/stanza.mli b/src/stanza.mli index a5afd51ac4d..864e159a912 100644 --- a/src/stanza.mli +++ b/src/stanza.mli @@ -4,6 +4,8 @@ open! Stdune type t = .. +val latest_version : Syntax.Version.t + module Parser : sig (** Type of stanza parser. diff --git a/src/super_context.ml b/src/super_context.ml index f74d9a599bd..ab57831c7d2 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -700,7 +700,7 @@ module Action = struct "This action has targets in a different directory than the current \ one, this is not allowed by dune at the moment:\n%s" (List.map targets ~f:(fun target -> - sprintf "- %s" (Utils.describe_path (Path.build target))) + sprintf "- %s" (Dpath.describe_path (Path.build target))) |> String.concat ~sep:"\n")); let build = Build.record_lib_deps (Expander.Resolved_forms.lib_deps forms) diff --git a/src/utils.ml b/src/utils.ml index 908eb8b1784..76a6332d560 100644 --- a/src/utils.ml +++ b/src/utils.ml @@ -65,73 +65,6 @@ let signal_name = | None -> sprintf "%d\n" n | Some s -> s -type target_kind = - | Regular of string * Path.Source.t - | Alias of string * Path.Source.t - | Install of string * Path.Source.t - | Other of Path.Build.t - -type path_kind = - | Source of Path.Source.t - | External of Path.External.t - | Build of target_kind - -let analyse_target (fn as original_fn) : target_kind = - match Path.Build.extract_first_component fn with - | Some (".aliases", sub) -> - (match Path.Local.split_first_component sub with - | None -> Other fn - | Some (ctx, fn) -> - if Path.Local.is_root fn then - Other original_fn - else - let basename = - match String.rsplit2 (Path.Local.basename fn) ~on:'-' with - | None -> assert false - | Some (name, digest) -> - assert (String.length digest = 32); - name - in - Alias (ctx, - Path.Source.relative - (Path.Source.of_local (Path.Local.parent_exn fn)) - basename)) - | Some ("install", sub) -> - (match Path.Local.split_first_component sub with - | None -> Other fn - | Some (ctx, fn) -> - Install (ctx, Path.Source.of_local fn)) - | Some (ctx, sub) -> - Regular (ctx, Path.Source.of_local sub) - | None -> - Other fn - -let analyse_path (fn : Path.t) = match fn with - | In_source_tree src -> Source src - | External e -> External e - | In_build_dir build -> Build (analyse_target build) - -let describe_target fn = - let ctx_suffix = function - | "default" -> "" - | ctx -> sprintf " (context %s)" ctx - in - match analyse_target fn with - | Alias (ctx, p) -> - sprintf "alias %s%s" (Path.Source.to_string_maybe_quoted p) (ctx_suffix ctx) - | Install (ctx, p) -> - sprintf "install %s%s" (Path.Source.to_string_maybe_quoted p) (ctx_suffix ctx) - | Regular (ctx, fn) -> - sprintf "%s%s" (Path.Source.to_string_maybe_quoted fn) (ctx_suffix ctx) - | Other fn -> - Path.Build.to_string_maybe_quoted fn - -let describe_path (p : Path.t) = - match p with - | External _ | In_source_tree _ -> - Path.to_string_maybe_quoted p - | In_build_dir p -> describe_target p - let library_object_directory ~dir name = Path.Build.relative dir ("." ^ Lib_name.Local.to_string name ^ ".objs") @@ -182,9 +115,10 @@ let install_file ~(package : Package.Name.t) ~findlib_toolchain = let line_directive ~filename:fn ~line_number = let directive = - match Filename.extension fn with - | ".c" | ".cpp" | ".h" -> "line" - | _ -> "" + if C.c_cxx_or_header ~fn then + "line" + else + "" in sprintf "#%s %d %S\n" directive line_number fn diff --git a/src/utils.mli b/src/utils.mli index 767a0552e95..828ade68a67 100644 --- a/src/utils.mli +++ b/src/utils.mli @@ -12,10 +12,6 @@ val bash_exn : needed_to:string -> Path.t (** Convert a signal number to a name: INT, TERM, ... *) val signal_name : int -> string -(** Nice description of a target *) -val describe_target : Path.Build.t -> string -val describe_path : Path.t -> string - (** Return the directory where the object files for the given library should be stored. *) val library_object_directory @@ -38,21 +34,6 @@ val executable_object_directory -> string -> Path.Build.t -type target_kind = - | Regular of string (* build context *) * Path.Source.t - | Alias of string (* build context *) * Path.Source.t - | Install of string (* build context *) * Path.Source.t - | Other of Path.Build.t - -type path_kind = - | Source of Path.Source.t - | External of Path.External.t - | Build of target_kind - -(** Return the name of an alias from its stamp file *) -val analyse_target : Path.Build.t -> target_kind -val analyse_path : Path.t -> path_kind - (** Raise an error about a program not found in the PATH or in the tree *) val program_not_found : ?context:string diff --git a/src/vcs.ml b/src/vcs.ml index e22081dd567..e9d54440e6c 100644 --- a/src/vcs.ml +++ b/src/vcs.ml @@ -48,7 +48,7 @@ module T = struct let decode = let open Stanza.Decoder in record - (let+ root = field "root" Path_dune_lang.decode + (let+ root = field "root" Dpath.decode and+ kind = field "kind" Kind.decode in { root; kind })