llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.93k forks source link

Enable -Wundefined-reinterpret-cast by default or at least with -Wall/-Wextra #51247

Open Kojoley opened 3 years ago

Kojoley commented 3 years ago
Bugzilla Link 51905
Version unspecified
OS All
CC @dwblaikie,@zygoloid,@Weverything

Extended Description

The message in commit https://github.com/llvm/llvm-project/commit/0dc3f8db1a10d534a8b562d3db727261aa18931a (from 2011) says:

This was the actual cause of the only false positive in Clang+LLVM.

Next evaluation will be over a much larger selection of code including large amounts of open source code.

but I couldn't find what happened after.

Some projects with the warning enabled: https://chromium.googlesource.com/angle/angle/+/458389f249b0b68f430d7fe954c21205d22cd33e/BUILD.gn#200 https://github.com/mysql/mysql-server/blob/beb865a960b9a8a16cf999c323e46c5b0c67f21f/cmake/maintainer.cmake#L108 https://github.com/OpenSpace/OpenSpace/blob/db472030de710180ff96c9c8c707c19ef3bcfe41/support/cmake/set_openspace_compile_settings.cmake#L155

Weverything commented 3 years ago

It is not turned on. There's a spike of cases around void** types, which can probably be easily fixed by reordering dereferences. Other cases are harder to determine and will need a case-by-case analysis. Probably an involved cleanup.

dwblaikie commented 3 years ago

Richard - did we ever roll this out at Google/get a sense of the amount of cleanup required for this in such a large codebase?