Skip to content

Add -Werror -Wall flags (or equivalent) to ocamlopt #12050

@dannywillems

Description

@dannywillems

For the moment,

$ ocamlopt -config 
version: 4.13.1
[...]
ocamlopt_cflags: -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -O2 -ffile-prefix-map=/build/ocaml-SC7b9w/ocaml-4.13.1=. -fstack-protector-strong -Wformat -Werror=format-security
[...]

Is there any reason -Wall -Wextra is not added by default (or any "stronger" or equivalent flags/build warnings/errors)?
Discussions with other members of the OCaml community "offline" seems to give a compatibility reason with the different C compilers.

IMHO, it would increase the code quality and (sometimes) security, and avoid bug reports like [2].
On another side, it might list warnings as errors in projects which do not include these flags by default. However, I think it is positive.

I am opening this issue for discussions.

[1] gcc options: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
[2] yallop/ocaml-ctypes#248

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions