[PATCH] D134831: [Clang][Sema] Add -Wcast-function-type-strict

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 21 08:12:34 PST 2023


samitolvanen added a comment.

In D134831#4137408 <https://reviews.llvm.org/D134831#4137408>, @inglorion wrote:

> Is this intended to warn on code that casts a function taking a pointer to some non-void type to a function that takes a void*?

Yes, this is intended to warn if the function types don't match.

> I didn't see this mentioned in the diff description, comments, or test. Is the behavior intentional? Are these types actually incompatible?

As far as the language is concerned, the types are not incompatible, but calling the function pointer would trip `-fsanitize=cfi` checking, which this warning is meant to catch. If your program is not using CFI, you may want to consider disabling the `-strict` warning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134831/new/

https://reviews.llvm.org/D134831



More information about the cfe-commits mailing list