Skip to content

Commit 179df8e

Browse files
Abhinkopronlieb
authored andcommitted
[clang] move -Wcast-function-type under -Wextra (llvm#77178)
The -Wcast-fuction-type-strict has been moved under dignstic group -Wextra. Edited the test cases for -Wcast-fuction-type-strict and -Wcast-fuction-type in Sema an SemaCXX. Added a new test case which include a functionality that was already in the -Wextra group, i.e -Wignored-qualifiers with -Wcast-fuction-type-strict. Fixes: llvm#76872 Change-Id: I800fdce58c0429df56c07bfa17a7e3ba98684e8d
1 parent e763b93 commit 179df8e

6 files changed

+8
-1
lines changed

clang/docs/ReleaseNotes.rst

+2
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ Modified Compiler Flags
213213
the ``promoted`` algorithm for complex division when possible rather than the
214214
less basic (limited range) algorithm.
215215

216+
- Added ``-Wcast-function-type`` as a warning enabled by ``-Wextra``. #GH76872
217+
216218
Removed Compiler Flags
217219
-------------------------
218220

clang/include/clang/Basic/DiagnosticGroups.td

+1
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ def Extra : DiagGroup<"extra", [
10631063
EmptyInitStatement,
10641064
StringConcatation,
10651065
FUseLdPath,
1066+
CastFunctionType,
10661067
]>;
10671068

10681069
def Most : DiagGroup<"most", [

clang/test/Sema/warn-cast-function-type-strict.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 %s -fsyntax-only -Wcast-function-type -verify
22
// RUN: %clang_cc1 %s -fsyntax-only -Wcast-function-type-strict -verify
3-
3+
// RUN: %clang_cc1 %s -fsyntax-only -Wextra -Wno-ignored-qualifiers -verify
44

55
int t(int array[static 12]);
66
int u(int i);
@@ -48,5 +48,6 @@ void foo(void) {
4848
g = (f7 *)x; /* expected-warning {{cast from 'int (*)(long)' to 'f7 *' (aka 'int (*)(long, ...)') converts to incompatible function type}} */
4949
h = (f8 *)t;
5050
i = (f9 *)u;
51+
// FIXME: return type qualifier should not be included in the function type . Warning should be absent after this issue is fixed. https://github.com/llvm/llvm-project/issues/39494 .
5152
j = (f10 *)v; /* expected-warning {{cast from 'const int (*)(int)' to 'f10 *' (aka 'int (*)(int)') converts to incompatible function type}} */
5253
}

clang/test/Sema/warn-cast-function-type.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -fsyntax-only -Wcast-function-type -Wno-cast-function-type-strict -verify
2+
// RUN: %clang_cc1 %s -fsyntax-only -Wextra -Wno-cast-function-type-strict -verify
23

34
int x(long);
45

clang/test/SemaCXX/warn-cast-function-type-strict.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type -verify
22
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type-strict -verify
3+
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wextra -verify
34

45
int x(long);
56

clang/test/SemaCXX/warn-cast-function-type.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wcast-function-type -Wno-cast-function-type-strict -verify
2+
// RUN: %clang_cc1 %s -fblocks -fsyntax-only -Wextra -Wno-cast-function-type-strict -verify
23

34
int x(long);
45

0 commit comments

Comments
 (0)