Skip to content

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

@thesamesam

Description

@thesamesam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions