Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compilers: c: add Modern C -Werrors for GCC, Clang
Add the following flags to error out by default via a new default-on 'Dc_legal_code' option for GCC and Clang: * -Werror=implicit (-> -Werror=implicit-int,implicit-function-declaration) * -Werror=int-conversion * -Werror=incompatible-pointer-types Implicit function declarations were removed in C99 with no deprecation period because of how dangerous they are. Implicit conversions between integers and pointers were also never allowed in >= C89. These were allowed by GCC and Clang until recently for compatibility reasons: * GCC plans to make these errors by default in GCC 14 * Clang made -Werror=int-conversion a default error in Clang 15 and made the others an error in Clang 16 The reason for Meson to do this even for older compilers is straightforward: * It'll take time for these newer versions to propagate into distributions. * The code emitting these is broken *now*. * Projects like PipeWire and various GNOME components are adding these flags manually to catch them already. Signed-off-by: Sam James <[email protected]>
- Loading branch information