[all-commits] [llvm/llvm-project] 217f0f: [Clang][Sema] Implement GCC -Wcast-function-type
Yuanfang Chen via All-commits
all-commits at lists.llvm.org
Wed Mar 24 16:05:08 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 217f0f735afec57a51fa6f9ab863d4713a2f85e2
https://github.com/llvm/llvm-project/commit/217f0f735afec57a51fa6f9ab863d4713a2f85e2
Author: Yuanfang Chen <yuanfang.chen at sony.com>
Date: 2021-03-24 (Wed, 24 Mar 2021)
Changed paths:
M clang/docs/DiagnosticsReference.rst
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaCast.cpp
A clang/test/Sema/warn-cast-function-type.c
A clang/test/Sema/warn-cast-function-type.cpp
Log Message:
-----------
[Clang][Sema] Implement GCC -Wcast-function-type
```
Warn when a function pointer is cast to an incompatible function
pointer. In a cast involving function types with a variable argument
list only the types of initial arguments that are provided are
considered. Any parameter of pointer-type matches any other
pointer-type. Any benign differences in integral types are ignored, like
int vs. long on ILP32 targets. Likewise type qualifiers are ignored. The
function type void (*) (void) is special and matches everything, which
can be used to suppress this warning. In a cast involving pointer to
member types this warning warns whenever the type cast is changing the
pointer to member type. This warning is enabled by -Wextra.
```
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D97831
More information about the All-commits
mailing list