Skip to content

Commit 891c5b4

Browse files
committed
add ppopt(arg) and ppxopt(package,arg) when -use-ocamlfind
1 parent 6ea975d commit 891c5b4

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ of the usual "- ".
1414
NEXT_RELEASE:
1515
-------------
1616

17+
- #45, #190: add ppopt(arg) and ppxopt(package,arg) when -use-ocamlfind
18+
(Gabriel Scherer,
19+
request by Gabriel Scherer, Gabriel Radanne and Pavel Argentov)
20+
1721
0.12.0 (11 Nov 2017):
1822
---------------------
1923

manual/manual.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ Also note that the quoting, `-tag "syntax(camlp4o)"` instead of `-tag syntax(c
309309

310310
If you use `-ppx` preprocessors, you can use the parametrized tag `ppx(...)` (`-tag "ppx(...)"`) to specify the preprocessor to use.
311311

312+
Since ocamlbuild NEXT_RELASE, the tags `ppopt(option)` and `ppxopt(package,option)` are also supported -- if you have set `-use-ocamlfind`.
313+
312314
// TODO: Improve title.
313315
[[Sec_Archives_documentation]]
314316
=== Archives, documentation
@@ -761,6 +763,8 @@ Feel free to look at the implementation and link:../CONTRIBUTING.adoc[send a pat
761763
* `dontlink(pkgname)`
762764
* `predicate(foo)`
763765
* `syntax(bar)`
766+
* `ppopt(camlp4-option)` (since NEXT_RELEASE)
767+
* `ppxopt(package,option)` (since NEXT_RELEASE)
764768

765769
===== `ocamllex` tags
766770

src/ocaml_specific.ml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,19 @@ let () =
693693
["c"; "compile"];
694694
] in
695695

696-
(* tags package(X), predicate(X) and syntax(X) *)
696+
(* tags package(X), predicate(X) and syntax(X), ppopt(X), ppxopt(X) *)
697697
List.iter begin fun tags ->
698698
pflag tags "package" ~doc_param (fun pkg -> S [A "-package"; A pkg]);
699699
pflag tags "predicate" ~doc_param:"archive"
700700
(fun pkg -> S [A "-predicates"; A pkg]);
701-
if List.mem "ocaml" tags then
702-
pflag tags "syntax" ~doc_param:"camlp4o" (fun pkg -> S [A "-syntax"; A pkg])
701+
if List.mem "ocaml" tags then begin
702+
pflag tags "syntax" ~doc_param:"camlp4o"
703+
(fun pkg -> S [A "-syntax"; A pkg]);
704+
pflag tags "ppopt" ~doc_param:"camlp4-arg"
705+
(fun arg -> S [A "-ppopt"; A arg]);
706+
pflag tags "ppxopt" ~doc_param:"package,arg"
707+
(fun arg -> S [A "-ppxopt"; A arg]);
708+
end;
703709
end all_tags
704710
end else begin
705711
try

testsuite/external.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,17 @@ let () = test "SubtoolOptions"
4343
~targets:("parser.native",["parser.byte"])
4444
();;
4545

46+
let () = test "ppopt"
47+
~description:"Test the -ppopt option for camlp4 arguments"
48+
~requirements:(package_exists "camlp4")
49+
~options:[`use_ocamlfind; `package "camlp4"; `syntax "camlp4o";
50+
`tags ["ppopt(-no_quot)"];
51+
]
52+
~tree:[T.f "test.ml"
53+
(* <<y>> looks like a camlp4 location and
54+
will fail to compile unless '-no_quot' is passed *)
55+
~content:"let test (<<) (>>) x y z = x <<y>> z"]
56+
~targets:("test.cmo",[])
57+
();;
58+
4659
run ~root:"_test_external";;

0 commit comments

Comments
 (0)