From 8cb804a3c9ce2ba4e6d4a04d9ff48329a701f2cb Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 8 Oct 2019 19:14:34 +0000 Subject: [PATCH] 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 --- .../readability-redundant-declaration.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp index 2a3dd7a1..47c9584 100644 --- a/clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-redundant-declaration.cpp @@ -2,6 +2,21 @@ // RUN: -config="{CheckOptions: \ // RUN: [{key: readability-redundant-declaration.IgnoreMacros, \ // RUN: value: 0}]}" +// +// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't +// produce additional diagnostics, so same check suffix as before: +// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \ +// RUN: -config="{CheckOptions: \ +// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \ +// RUN: value: 0}]}" -- -fms-compatibility -DEXTERNINLINE +// +// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output. +// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.) +// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \ +// RUN: %s readability-redundant-declaration %t -- \ +// RUN: -config="{CheckOptions: \ +// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \ +// RUN: value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE extern int Xyz; extern int Xyz; // Xyz @@ -74,6 +89,8 @@ inline void g(); // g // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration // CHECK-FIXES: {{^}}// g{{$}} +#if defined(EXTERNINLINE) extern inline void g(); // extern g -// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: redundant 'g' declaration -// CHECK-FIXES: {{^}}// extern g{{$}} +// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' declaration +// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}} +#endif -- 2.7.4