Function Usage: Make sure it's detected that func is used in code such as 'if ( func() ) { ..'
This commit is contained in:
parent
29a1468523
commit
ce14eb6590
|
@ -103,7 +103,7 @@ void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer )
|
|||
if ( TOKEN::Match(funcname, "%var% (") )
|
||||
{
|
||||
int parlevel = 0;
|
||||
for ( const TOKEN *tok2 = tok; tok2; tok2 = tok2->next )
|
||||
for ( const TOKEN *tok2 = funcname; tok2; tok2 = tok2->next )
|
||||
{
|
||||
if (TOKEN::Match(tok2, "("))
|
||||
++parlevel;
|
||||
|
|
4
Makefile
4
Makefile
|
@ -1,6 +1,6 @@
|
|||
SRCS=CheckBufferOverrun.cpp CheckClass.cpp CheckHeaders.cpp CheckMemoryLeak.cpp CheckFunctionUsage.cpp CheckOther.cpp FileLister.cpp preprocessor.cpp tokenize.cpp cppcheck.cpp settings.cpp token.cpp
|
||||
OBJS=$(SRCS:%.cpp=%.o)
|
||||
TESTS=testbufferoverrun.o testcharvar.o testconstructors.o testdivision.o testincompletestatement.o testmemleak.o testpreprocessor.o testsimplifytokens.o testtokenize.o testunusedprivfunc.o testunusedvar.o settings.o cppcheck.o token.o
|
||||
TESTS=testbufferoverrun.o testcharvar.o testconstructors.o testdivision.o testfunctionusage.o testincompletestatement.o testmemleak.o testpreprocessor.o testsimplifytokens.o testtokenize.o testunusedprivfunc.o testunusedvar.o settings.o cppcheck.o token.o
|
||||
BIN = ${DESTDIR}/usr/bin
|
||||
|
||||
all: ${OBJS} main.o
|
||||
|
@ -39,6 +39,8 @@ testconstructors.o: testconstructors.cpp tokenize.h CheckClass.h testsuite.h
|
|||
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
|
||||
testdivision.o: testdivision.cpp tokenize.h CheckOther.h testsuite.h
|
||||
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
|
||||
testfunctionusage.o: testfunctionusage.cpp tokenize.h CheckFunctionUsage.h testsuite.h
|
||||
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
|
||||
testincompletestatement.o: testincompletestatement.cpp testsuite.h tokenize.h CheckOther.h
|
||||
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
|
||||
testmemleak.o: testmemleak.cpp tokenize.h CheckMemoryLeak.h testsuite.h
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<Unit filename="testcharvar.cpp" />
|
||||
<Unit filename="testconstructors.cpp" />
|
||||
<Unit filename="testdivision.cpp" />
|
||||
<Unit filename="testfunctionusage.cpp" />
|
||||
<Unit filename="testincompletestatement.cpp" />
|
||||
<Unit filename="testmemleak.cpp" />
|
||||
<Unit filename="testpreprocessor.cpp" />
|
||||
|
|
Loading…
Reference in New Issue