flexdll icon indicating copy to clipboard operation
flexdll copied to clipboard

Add and fix C compiler warnings

Open MisterDA opened this issue 1 year ago • 0 comments

I noticed that the CPPFLAGS and CFLAGS were not being passed when building Flexdll's C files, but they introduce problems when building OCaml 4.06 and 4.07 (explanation from David Allsopp):

  • The underlying OCaml compiler is msvc64, unless OCAML_PORT is set in AppVeyor matrix (so OCaml in the 4.06 and 4.07 tests is msvc64);
  • https://github.com/ocaml/ocaml/pull/1114 (4.06.0) introduced CFLAGS and CPPFLAGS in the OCaml's installed Makefile.config;
  • FlexDLL's Makefile includes that $(ocamlopt -where)/Makefile.config so ends up getting OCaml's msvc64 CFLAGS and CPPFLAGS values;
  • https://github.com/ocaml/ocaml/pull/1840 (4.08.0) renamed them to OC_CFLAGS and OC_CPPFLAGS which removes the problem.

I've instead chosen to add -Wall to enable warnings when compiling C files. To make sure new problems are not introduced, the warnings are turned into errors if and only if the CI environment variable matches [Tt]rue.

I've then tentatively fixed the warnings raised by GCC and MSVC.

MisterDA avatar Jan 17 '24 13:01 MisterDA