Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -Wincompatible-pointer-types an error by default #74605

Open
thesamesam opened this issue Dec 6, 2023 · 1 comment
Open

Make -Wincompatible-pointer-types an error by default #74605

thesamesam opened this issue Dec 6, 2023 · 1 comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@thesamesam
Copy link
Member

thesamesam commented Dec 6, 2023

GCC 14 plans to make -Wincompatible-pointer-types an error by default for >= C99. GCC may still roll back this specific change (while retaining the other modern C changes) for GCC 14 and reinstate that one change again later depending on how we get on with the porting work. My hope is that we won't need to do that, but I mention it for full disclosure.

Clang has a subset warning, -Wincompatible-function-pointer-types, which was made fatal in Clang 16. GCC hasn't implemented this subset warning, but after discussion (some at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109835, some off-bug), decided this probably wasn't worth it, and to go wholehog with -Wincompatible-pointer-types as an error instead.

fweimer and I have already been doing the various autoconf configure comparisons and so on. so far, the damage isn't really bad at all for the configure check side, although the blast radius in general for C is still fairly big (but manageable) for the warning overall.

I think it makes sense for Clang to make -Wincompatible-pointer-types an error as well, given that it's very often an indicator of wrong code. So far, many of the examples I've seen were either always outright broken, or at least broken on 32-bit. I also think it makes sense to have a united front for the overall Modern C effort and to have consistent behaviour for GCC and Clang here.

cc @AaronBallman

@EugeneZelenko EugeneZelenko added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed new issue labels Dec 6, 2023
@AaronBallman
Copy link
Collaborator

I think it makes sense to strengthen -Wincompatible-pointer-types into an error -- that definitely raises the bar with our security posture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

No branches or pull requests

3 participants