This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
(executable
|
||||
(name w_omp_driver)
|
||||
(modules w_omp_driver)
|
||||
(preprocess
|
||||
(pps fooppx -- -flag -arg omp)))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(lang dune 1.7)
|
||||
(name fooppx)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(library
|
||||
(name fooppx)
|
||||
(public_name fooppx)
|
||||
(kind ppx_rewriter)
|
||||
(libraries ppxlib))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
let flag = ref false
|
||||
let arg = ref ""
|
||||
|
||||
let () =
|
||||
Ppxlib.Driver.add_arg "-flag" (Arg.Set flag) ~doc:"";
|
||||
Ppxlib.Driver.add_arg "-arg" (Arg.Set_string arg) ~doc:"";
|
||||
Ppxlib.Driver.register_transformation
|
||||
"linter"
|
||||
~impl:(fun s ->
|
||||
if not !flag then (
|
||||
Format.eprintf "pass -flag to fooppx@.%!";
|
||||
exit 1
|
||||
);
|
||||
if !arg = "" then (
|
||||
Format.eprintf "pass -arg to fooppx@.%!"
|
||||
);
|
||||
Format.eprintf "-arg: %s@." !arg;
|
||||
s
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
$ dune build ./w_omp_driver.exe
|
||||
-arg: omp
|
||||
|
||||
This test is broken because ppx_driver doesn't support migrate custom arguments
|
||||
# $ dune build ./w_ppx_driver_flags.exe
|
||||
$ dune build && dune exec -- ocamlfind opt -package fooppx -ppxopt "fooppx,-flag" -linkpkg w_omp_driver.ml -o w_omp_driver.exe
|
||||
pass -arg to fooppx
|
||||
-arg:
|
||||
Loading…
Add table
Add a link
Reference in a new issue