[clang] [clang] move -Wcast-function-type under -Wextra (PR #77178)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 21 05:18:11 PDT 2024


AaronBallman wrote:

I'm confused as to how this code ever compiled in the first place... In each case, this is C++ code that's failing:
```
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:219:25: error: cast from 'SignalHandlerType' (aka 'void (*)(int, void *, void *)') to 'sa_sigaction_t' (aka 'void (*)(int, siginfo_t *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:437:4: error: cast from 'void (*)()' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]

/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:460:54: error: cast from 'void (*)(void *)' to 'void (*)()' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
```
All of which is being compiled in `-std=c++17` and none of which are valid in C++ and the behavior is the same between Clang 18, trunk, and GCC: https://godbolt.org/z/WY9zvsa8z

@amy-kwan we may need some help from you with investigating this; but in the meantime, this commit can be reverted to get the bots back to green if that's blocking you.


https://github.com/llvm/llvm-project/pull/77178


More information about the cfe-commits mailing list