1- // RUN: %check_clang_tidy %s bugprone-easily-swappable-parameters %t \
1+ // RUN: %check_clang_tidy -std=c99,c11,c17 -check-suffixes=,BEFORE-C23 %s bugprone-easily-swappable-parameters %t \
2+ // RUN: -config='{CheckOptions: { \
3+ // RUN: bugprone-easily-swappable-parameters.MinimumLength: 2, \
4+ // RUN: bugprone-easily-swappable-parameters.IgnoredParameterNames: "", \
5+ // RUN: bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes: "", \
6+ // RUN: bugprone-easily-swappable-parameters.QualifiersMix: 0, \
7+ // RUN: bugprone-easily-swappable-parameters.ModelImplicitConversions: 0, \
8+ // RUN: bugprone-easily-swappable-parameters.SuppressParametersUsedTogether: 1, \
9+ // RUN: bugprone-easily-swappable-parameters.NamePrefixSuffixSilenceDissimilarityTreshold: 0 \
10+ // RUN: }}' -- -Wno-strict-prototypes -x c
11+ //
12+ // RUN: %check_clang_tidy -std=c23-or-later %s bugprone-easily-swappable-parameters %t \
213// RUN: -config='{CheckOptions: { \
314// RUN: bugprone-easily-swappable-parameters.MinimumLength: 2, \
415// RUN: bugprone-easily-swappable-parameters.IgnoredParameterNames: "", \
@@ -18,16 +29,18 @@ void notRelated(int A, int B) {}
1829
1930int addedTogether (int A , int B ) { return add (A , B ); } // NO-WARN: Passed to same function.
2031
21- // FIXME: This triggers a false positive: the "passed to same function" heuristic
22- // can't map the parameter index 1 to A and B because myprint() has no
23- // parameters.
24- // warning: 2 adjacent parameters of 'passedToSameKNRFunction' of similar type ('int')
25- // note: the first parameter in the range is 'A'
26- // note: the last parameter in the range is 'B'
27- #if 0
32+ #if __STDC_VERSION__ < 202311L
2833int myprint ();
2934void passedToSameKNRFunction (int A , int B ) {
3035 myprint ("foo" , A );
3136 myprint ("bar" , B );
3237}
38+ // CHECK-MESSAGES-BEFORE-C23: :[[@LINE-4]]:30: warning: 2 adjacent parameters of 'passedToSameKNRFunction' of similar type ('int')
39+ // CHECK-MESSAGES-BEFORE-C23: :[[@LINE-5]]:34: note: the first parameter in the range is 'A'
40+ // CHECK-MESSAGES-BEFORE-C23: :[[@LINE-6]]:41: note: the last parameter in the range is 'B'
41+ // FIXME: This is actually a false positive: the "passed to same function" heuristic
42+ // can't map the parameter index 1 to A and B because myprint() has no
43+ // parameters.
44+ // If you fix this, you should be able to combine the `%check_clang_tidy` invocations
45+ // in this file into one and remove the `-std` and `-check-suffixes` arguments.
3346#endif
0 commit comments