Skip to content

Commit

Permalink
Fail when bytecode linkage + C stubs is requested
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
  • Loading branch information
nojb committed Aug 20, 2019
1 parent fbd03ec commit fda8cd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/dune/exe_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ let executables_rules ~sctx ~dir ~expander ~dir_contents ~scope ~compile_info
let o_files =
if not (Executables.has_stubs exes) then
None
else
else (
if List.mem Exe.Linkage.byte ~set:linkages then
User_error.raise ~loc:exes.buildable.loc
[ Pp.textf "Pure bytecode executables cannot contain C stubs."
; Pp.textf "Did you forget to add `(modes exe)'?"
];
let c_sources =
Dir_contents.c_sources_of_executables dir_contents ~first_exe
in
Expand All @@ -122,6 +127,7 @@ let executables_rules ~sctx ~dir ~expander ~dir_contents ~scope ~compile_info
in
Check_rules.add_files sctx ~dir o_files;
Some o_files
)
in
let requires_compile = Compilation_context.requires_compile cctx in
Exe.build_and_link_many cctx ~programs ~linkages ~link_flags ?o_files
Expand Down
3 changes: 2 additions & 1 deletion test/blackbox-tests/test-cases/exes-with-c/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(executables
(names aa bb)
(c_names foo))
(c_names foo)
(modes exe))

0 comments on commit fda8cd1

Please sign in to comment.