compiler-builtins icon indicating copy to clipboard operation
compiler-builtins copied to clipboard

Turn on -werror for C code build?

Open jonathanpallant opened this issue 2 years ago • 3 comments

I've spent quite a lot of time chasing down an issue with a new Rust target, which turned out to be the vendor's stdint.h not including UINT64_C. This produced a warning (and a call to an imagined function int UINT64_C(int), because C) but that scrolled past quickly and didn't stop the build.

Perhaps we could enable -Werror on the CC crate when building the C code to catch this kind of things in the future.

jonathanpallant avatar Feb 09 '23 14:02 jonathanpallant

I would prefer not to. -Werror is extremely brittle because it can cause build failures when the C compiler is updated and introduces new warnings.

Amanieu avatar Feb 13 '23 01:02 Amanieu

Can we enable something to catch "using a function that hasn't previously been declared?" That's always a serious bug, surely.

jonathanpallant avatar Feb 13 '23 10:02 jonathanpallant

Sure, I think it's fine to enable it for specific warnings. Just not a blanket -Werror. Also make sure the compiler in question actually supports flag.

Amanieu avatar Feb 13 '23 10:02 Amanieu