Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSL handling for {c,cxx}_names #1788

Merged
merged 12 commits into from
Feb 4, 2019
17 changes: 17 additions & 0 deletions src/c_sources.ml
Original file line number Diff line number Diff line change
@@ -109,5 +109,22 @@ let make (d : _ Dir_with_dune.t)
in this directory"
Lib_name.pp_quoted name
in
let () =
let rev_map =
List.concat_map libs ~f:(fun (_, c_sources) ->
String.Map.values c_sources
|> List.map ~f:(fun (loc, source) ->
(C.Source.path source, loc)))
|> Path.Map.of_list
in
match rev_map with
| Ok _ -> ()
| Error (_, loc1, loc2) ->
Errors.fail loc2
"This c stub is already used in another stanza:@\n\
@[<v>%a@]@\n"
(Fmt.prefix (Fmt.string "- ") Loc.pp_file_colon_line)
loc1
in
{ libraries
}
7 changes: 5 additions & 2 deletions test/blackbox-tests/test-cases/duplicate-c-cxx/run.t
Original file line number Diff line number Diff line change
@@ -10,7 +10,10 @@ c_names and cxx_names with overlapping names in the same stanza
c_names with overlapping names in different stanzas
$ dune build --root diff-stanza @all
Entering directory 'diff-stanza'
Multiple rules generated for _build/default/foo$ext_obj:
- dune:9
File "dune", line 9, characters 10-13:
9 | (c_names foo))
^^^
Error: This c stub is already used in another stanza:
- dune:4

[1]