diff --git a/quality/compile_check.bzl b/quality/compile_check.bzl index be4a9c5867..740d91738e 100644 --- a/quality/compile_check.bzl +++ b/quality/compile_check.bzl @@ -137,6 +137,8 @@ def ghc_check_argv(argv, scratch): _OCAML_DROP = ["-bin-annot", "-annot", "-c"] +_OCAML_VALUE_FLAGS = ["-w", "-warn-error"] + _OCAML_FLAGS = ["-stop-after", "typing", "-error-style", "short", "-color", "never"] def _basename(path): @@ -156,7 +158,10 @@ def ocaml_check_argv(argv, scratch): output = "" compiles = 0 take = "" + previous = "" for arg in argv[1:]: + value_of = previous + previous = arg if take != "": if take == "-o": output = arg @@ -166,7 +171,7 @@ def ocaml_check_argv(argv, scratch): intf = arg take = "" continue - if arg.startswith("@"): + if arg.startswith("@") and value_of not in _OCAML_VALUE_FLAGS: return _fail("params files are not supported (found " + arg + ")") if arg in ["-o", "-impl", "-intf"]: take = arg diff --git a/quality/compile_check_tests.bzl b/quality/compile_check_tests.bzl index 189cadabb6..973beccbb6 100644 --- a/quality/compile_check_tests.bzl +++ b/quality/compile_check_tests.bzl @@ -143,6 +143,11 @@ def compile_check_unit_tests(name): ocaml_check_argv([_OCAMLC, "@a.params", "-c", "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error != "", True, ), + expect_equal( + "ocaml warning specs starting with @ are flag values", + ocaml_check_argv([_OCAMLC, "-w", "@1..3@5..28", "-warn-error", "@8", "-c", "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error, + "", + ), expect_equal( "ocaml without -c is rejected", ocaml_check_argv([_OCAMLC, "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error != "",