From f7e7e84ca0e6c5f6ccf21c19c47e9bc9bd517862 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sun, 24 Nov 2019 14:16:06 +0000 Subject: [PATCH 1/4] ppx_cstruct: also add stdlib-shims to the runtime deps Otherwise this will fail in generated code on pre 4.06 --- ppx/dune | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppx/dune b/ppx/dune index bd5d6d6f..bd28df65 100644 --- a/ppx/dune +++ b/ppx/dune @@ -3,7 +3,7 @@ (public_name ppx_cstruct) (kind ppx_rewriter) (wrapped false) - (ppx_runtime_libraries cstruct) + (ppx_runtime_libraries cstruct stdlib-shims) (preprocess (pps ppx_tools_versioned.metaquot_404)) (libraries sexplib ocaml-migrate-parsetree ppx_tools_versioned From a5aa4049f1e110a6f209181a54c4c3586c68a98c Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sun, 24 Nov 2019 14:16:24 +0000 Subject: [PATCH 2/4] CI: also test ppx_cstruct --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f89dd241..56c63e62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,9 +37,9 @@ jobs: ocaml-version: ${{ matrix.ocaml-version }} - run: opam pin add -n . - name: Packages - run: opam depext -yt cstruct cstruct-sexp cstruct-unix cstruct-lwt + run: opam depext -yt cstruct cstruct-sexp cstruct-unix cstruct-lwt ppx_cstruct - name: Build - run: opam install -t cstruct cstruct-sexp cstruct-unix cstruct-lwt + run: opam install -t cstruct cstruct-sexp cstruct-unix cstruct-lwt ppx_cstruct async: name: Async runs-on: ${{ matrix.operating-system }} From d696925a70a65dbc3316e77eaee28e1d7bee8623 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sun, 24 Nov 2019 15:51:27 +0000 Subject: [PATCH 3/4] Fix tests on 4.07+ This sets the error style to short, so it should work on previous compilers as well Closes #263 --- ppx_cstruct.opam | 1 + ppx_test/errors/dune | 2 ++ ppx_test/errors/gen_tests.ml | 1 + ppx_test/errors/pp.ml | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/ppx_cstruct.opam b/ppx_cstruct.opam index 27502c3e..131d23f8 100644 --- a/ppx_cstruct.opam +++ b/ppx_cstruct.opam @@ -25,6 +25,7 @@ depends: [ "ppx_sexp_conv" {with-test} "sexplib" {>="v0.9.0"} "cstruct-sexp" {with-test} + "cppo" {with-test} "cstruct-unix" {with-test & =version} "stdlib-shims" ] diff --git a/ppx_test/errors/dune b/ppx_test/errors/dune index 7a0eb551..92314158 100644 --- a/ppx_test/errors/dune +++ b/ppx_test/errors/dune @@ -1,6 +1,8 @@ (executable (name pp) (modules pp) + (preprocess (action + (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file}))) (libraries ppx_cstruct ocaml-migrate-parsetree)) diff --git a/ppx_test/errors/gen_tests.ml b/ppx_test/errors/gen_tests.ml index 65979bfe..ae972b6e 100644 --- a/ppx_test/errors/gen_tests.ml +++ b/ppx_test/errors/gen_tests.ml @@ -19,6 +19,7 @@ let output_stanzas name = let is_test = function | "pp.ml" -> false + | "pp.pp.ml" -> false | "gen_tests.ml" -> false | e -> Filename.check_suffix e ".ml" diff --git a/ppx_test/errors/pp.ml b/ppx_test/errors/pp.ml index b1c1c38c..4752df42 100644 --- a/ppx_test/errors/pp.ml +++ b/ppx_test/errors/pp.ml @@ -3,4 +3,8 @@ external sys_exit : int -> 'a = "caml_sys_exit" let () = at_exit (fun () -> sys_exit 0) +#if OCAML_VERSION >= (4,7,0) +let () = Clflags.(error_style := Some Short) +#endif + let () = Migrate_parsetree.Driver.run_main () From e7cdfe59c4bb2cfe700c8e8e7abf3f2a75aa1bd6 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Sun, 24 Nov 2019 17:34:13 +0000 Subject: [PATCH 4/4] update CHANGES and fix the version calculation for the error changes --- CHANGES.md | 9 +++++++++ ppx_test/errors/pp.ml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8d5b2911..0ba0c32a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +v5.1.1 2019-11-23 +----------------- + +This is a point release to fix a regression in 5.1.0 +on compilers earlier than 4.07. + +The release also fixes the test suite and CI on compilers +greater than 4.07. + v5.1.0 2019-11-23 ----------------- diff --git a/ppx_test/errors/pp.ml b/ppx_test/errors/pp.ml index 4752df42..d10d27b8 100644 --- a/ppx_test/errors/pp.ml +++ b/ppx_test/errors/pp.ml @@ -3,7 +3,7 @@ external sys_exit : int -> 'a = "caml_sys_exit" let () = at_exit (fun () -> sys_exit 0) -#if OCAML_VERSION >= (4,7,0) +#if OCAML_VERSION >= (4,8,0) let () = Clflags.(error_style := Some Short) #endif