Skip to content

Commit 8cb804a

Browse files
committed
Try to get readability-deleted-default.cpp to pass on Windows.
In MS compatibility mode, "extern inline void g()" is not a redundant declaration for "inline void g()", because of redeclForcesDefMSVC() (see PR19264, r205485). To fix, run the test with -fms-compatiblity forced on and off and explicit check for the differing behavior for extern inline. Final bit of PR43593. Differential Revision: https://reviews.llvm.org/D68640 llvm-svn: 374103
1 parent cb82922 commit 8cb804a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
// RUN: -config="{CheckOptions: \
33
// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
44
// RUN: value: 0}]}"
5+
//
6+
// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
7+
// produce additional diagnostics, so same check suffix as before:
8+
// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
9+
// RUN: -config="{CheckOptions: \
10+
// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
11+
// RUN: value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
12+
//
13+
// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
14+
// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
15+
// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
16+
// RUN: %s readability-redundant-declaration %t -- \
17+
// RUN: -config="{CheckOptions: \
18+
// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
19+
// RUN: value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
520

621
extern int Xyz;
722
extern int Xyz; // Xyz
@@ -74,6 +89,8 @@ inline void g(); // g
7489
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
7590
// CHECK-FIXES: {{^}}// g{{$}}
7691

92+
#if defined(EXTERNINLINE)
7793
extern inline void g(); // extern g
78-
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration
79-
// CHECK-FIXES: {{^}}// extern g{{$}}
94+
// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' declaration
95+
// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
96+
#endif

0 commit comments

Comments
 (0)