diff --git a/.travis.yml b/.travis.yml index a9935f97b0..c3a34a564a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,10 @@ matrix: - os: osx env: COMPILER=4.03 PACKAGE_MANAGER=macports LIBEV=yes +env: + global: + - LWT_WARNINGS_AS_ERRORS=yes + script: bash -e utils/travis.sh notifications: diff --git a/appveyor.yml b/appveyor.yml index ff72b8c853..497232d25c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,9 @@ environment: - {SYSTEM: cygwin, ARCH: x86, COMPILER: 4.04} - {SYSTEM: mingw, ARCH: x86_64, COMPILER: 4.03} + global: + LWT_WARNINGS_AS_ERRORS: yes + install: - 'IF "%ARCH%"=="x86" ( SET CYGSH=C:\Cygwin\bin\bash -lc ) ELSE ( SET CYGSH=C:\Cygwin64\bin\bash -lc )' - ps: '(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/$env:SYSTEM/$env:ARCH/ocaml/$env:COMPILER/install.ps1") | PowerShell -Command -' diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 1476603bda..f46911b8e0 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -65,6 +65,16 @@ let define_c_library name env = flag ["link"; "ocaml"; tag] & S (List.map (fun arg -> S[A"-cclib"; arg]) lib) end +let conditional_warnings_as_errors () = + match Sys.getenv "LWT_WARNINGS_AS_ERRORS" with + | "yes" -> + let flags = S [A "-warn-error"; A "+A"] in + flag ["ocaml"; "compile"] flags; + flag ["ocaml"; "link"] flags + + | _ -> () + | exception Not_found -> () + let () = dispatch (fun hook -> @@ -119,7 +129,9 @@ let () = end; List.iter (fun name -> - mark_tag_used (c_library_tag name)) c_libraries + mark_tag_used (c_library_tag name)) c_libraries; + + conditional_warnings_as_errors () | _ -> ())