We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 987d3b4 commit a7faefcCopy full SHA for a7faefc
2 files changed
lib/checkother.cpp
@@ -4043,7 +4043,7 @@ void CheckOtherImpl::checkFuncArgNamesDifferent()
4043
definitions[j] = variable->nameToken();
4044
}
4045
// get the declaration (search for first token with varId)
4046
- while (decl && !Token::Match(decl, ",|)|;")) {
+ while (decl && !Token::Match(decl, "[,;]")) {
4047
// skip everything after the assignment because
4048
// it could also have a varId or be the first
4049
// token with a varId if there is no name token
@@ -4052,7 +4052,7 @@ void CheckOtherImpl::checkFuncArgNamesDifferent()
4052
break;
4053
4054
// skip over templates and arrays
4055
- if (decl->link() && decl->str() != "(")
+ if (decl->link() && !Token::Match(decl, "[()]"))
4056
decl = decl->link();
4057
else if (decl->varId())
4058
declarations[j] = decl;
test/testother.cpp
@@ -12955,6 +12955,10 @@ class TestOther : public TestFixture {
12955
"[test.cpp:1:12]: (style, inconclusive) Function 'f' argument 1 names different: declaration 'a' definition '<unnamed>'. [funcArgNamesDifferentUnnamed]\n"
12956
"[test.cpp:4:12]: (style, inconclusive) Function 'g' argument 1 names different: declaration '<unnamed>' definition 'b'. [funcArgNamesDifferentUnnamed]\n",
12957
errout_str());
12958
+
12959
+ check("void f(void (*fp)(), int x);\n" // #14847
12960
+ "void f(void (*fp)(), int x) {}\n");
12961
+ ASSERT_EQUALS("", errout_str());
12962
12963
12964
void funcArgOrderDifferent() {
0 commit comments