Skip to content

Commit e435a1f

Browse files
committed
Refactoring: Added src/ and test/ folders. Moved source files to those folders, updated makefile and codeblocks project file.
1 parent 1cf308f commit e435a1f

54 files changed

Lines changed: 129 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,88 @@
1-
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 cppcheckexecutor.cpp errormessage.cpp
1+
TMPSRCS=checkbufferoverrun.cpp checkclass.cpp checkheaders.cpp checkmemoryleak.cpp checkfunctionusage.cpp checkother.cpp filelister.cpp preprocessor.cpp tokenize.cpp cppcheck.cpp settings.cpp token.cpp cppcheckexecutor.cpp errormessage.cpp
2+
SRCS=$(TMPSRCS:%=src/%)
23
OBJS=$(SRCS:%.cpp=%.o)
3-
TESTS=testbufferoverrun.o testcharvar.o testclass.o testconstructors.o testdivision.o testfunctionusage.o testincompletestatement.o testother.o testmemleak.o testmemleakmp.o testpreprocessor.o testredundantif.o testsimplifytokens.o testtokenize.o testtoken.o testunusedprivfunc.o testunusedvar.o testfilelister.o
4+
TMPTESTS=testbufferoverrun.o testcharvar.o testclass.o testconstructors.o testdivision.o testfunctionusage.o testincompletestatement.o testother.o testmemleak.o testmemleakmp.o testpreprocessor.o testredundantif.o testsimplifytokens.o testtokenize.o testtoken.o testunusedprivfunc.o testunusedvar.o testfilelister.o
5+
TESTS=$(TMPTESTS:%=test/%)
46
BIN = ${DESTDIR}/usr/bin
57
CFLAGS = -Wall -pedantic -g
68

7-
all: ${OBJS} main.o
9+
all: ${OBJS} src/main.o
810
g++ $(CFLAGS) -o cppcheck $^
9-
test: ${OBJS} testrunner.o testsuite.o ${TESTS}
11+
test: ${OBJS} test/testrunner.o test/testsuite.o ${TESTS}
1012
g++ $(CFLAGS) -o testrunner $^
11-
cppcheckexecutor.o: cppcheckexecutor.cpp cppcheckexecutor.h cppcheck.h errorlogger.h
13+
cppcheckexecutor.o: src/cppcheckexecutor.cpp src/cppcheckexecutor.h src/cppcheck.h src/errorlogger.h
1214
g++ $(CFLAGS) -c $*.cpp
13-
cppcheck.o: cppcheck.cpp cppcheck.h settings.h errorlogger.h preprocessor.h tokenize.h token.h checkmemoryleak.h checkbufferoverrun.h checkclass.h checkheaders.h checkother.h checkfunctionusage.h filelister.h
15+
cppcheck.o: src/cppcheck.cpp src/cppcheck.h src/settings.h src/errorlogger.h src/preprocessor.h src/tokenize.h src/token.h src/checkmemoryleak.h src/checkbufferoverrun.h src/checkclass.h src/checkheaders.h src/checkother.h src/checkfunctionusage.h src/filelister.h
1416
g++ $(CFLAGS) -c $*.cpp
15-
main.o: main.cpp cppcheck.h settings.h errorlogger.h
17+
main.o: src/main.cpp src/cppcheck.h src/settings.h src/errorlogger.h
1618
g++ $(CFLAGS) -c $*.cpp
17-
checkbufferoverrun.o: checkbufferoverrun.cpp checkbufferoverrun.h tokenize.h settings.h errorlogger.h token.h
19+
checkbufferoverrun.o: src/checkbufferoverrun.cpp src/checkbufferoverrun.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
1820
g++ $(CFLAGS) -c $*.cpp
19-
checkclass.o: checkclass.cpp checkclass.h tokenize.h settings.h errorlogger.h token.h
21+
checkclass.o: src/checkclass.cpp src/checkclass.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
2022
g++ $(CFLAGS) -c $*.cpp
21-
checkfunctionusage.o: checkfunctionusage.cpp checkfunctionusage.h tokenize.h settings.h errorlogger.h token.h
23+
checkfunctionusage.o: src/checkfunctionusage.cpp src/checkfunctionusage.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
2224
g++ $(CFLAGS) -c $*.cpp
23-
checkheaders.o: checkheaders.cpp checkheaders.h tokenize.h settings.h errorlogger.h token.h
25+
checkheaders.o: src/checkheaders.cpp src/checkheaders.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
2426
g++ $(CFLAGS) -c $*.cpp
25-
checkmemoryleak.o: checkmemoryleak.cpp checkmemoryleak.h tokenize.h settings.h errorlogger.h token.h
27+
checkmemoryleak.o: src/checkmemoryleak.cpp src/checkmemoryleak.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
2628
g++ $(CFLAGS) -c $*.cpp
27-
checkother.o: checkother.cpp checkother.h tokenize.h settings.h errorlogger.h token.h
29+
checkother.o: src/checkother.cpp src/checkother.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h
2830
g++ $(CFLAGS) -c $*.cpp
29-
filelister.o: filelister.cpp filelister.h
31+
filelister.o: src/filelister.cpp src/filelister.h
3032
g++ $(CFLAGS) -c $*.cpp
31-
preprocessor.o: preprocessor.cpp preprocessor.h errorlogger.h token.h tokenize.h
33+
preprocessor.o: src/preprocessor.cpp src/preprocessor.h src/errorlogger.h src/token.h src/tokenize.h
3234
g++ $(CFLAGS) -c $*.cpp
33-
settings.o: settings.cpp settings.h
35+
settings.o: src/settings.cpp src/settings.h
3436
g++ $(CFLAGS) -c $*.cpp
35-
errormessage.o: errormessage.cpp errormessage.h
37+
errormessage.o: src/errormessage.cpp src/errormessage.h
3638
g++ $(CFLAGS) -c $*.cpp
37-
testbufferoverrun.o: testbufferoverrun.cpp tokenize.h settings.h errorlogger.h token.h checkbufferoverrun.h testsuite.h
39+
testbufferoverrun.o: test/testbufferoverrun.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkbufferoverrun.h test/testsuite.h
3840
g++ $(CFLAGS) -c $*.cpp
39-
testcharvar.o: testcharvar.cpp tokenize.h settings.h errorlogger.h token.h checkother.h testsuite.h
41+
testcharvar.o: test/testcharvar.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkother.h test/testsuite.h
4042
g++ $(CFLAGS) -c $*.cpp
41-
testclass.o: testclass.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
43+
testclass.o: test/testclass.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h test/testsuite.h
4244
g++ $(CFLAGS) -c $*.cpp
43-
testconstructors.o: testconstructors.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
45+
testconstructors.o: test/testconstructors.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h test/testsuite.h
4446
g++ $(CFLAGS) -c $*.cpp
45-
testdivision.o: testdivision.cpp tokenize.h settings.h errorlogger.h token.h checkother.h testsuite.h
47+
testdivision.o: test/testdivision.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkother.h test/testsuite.h
4648
g++ $(CFLAGS) -c $*.cpp
47-
testfunctionusage.o: testfunctionusage.cpp tokenize.h settings.h errorlogger.h token.h testsuite.h checkfunctionusage.h
49+
testfunctionusage.o: test/testfunctionusage.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h test/testsuite.h src/checkfunctionusage.h
4850
g++ $(CFLAGS) -c $*.cpp
49-
testincompletestatement.o: testincompletestatement.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h checkother.h
51+
testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h src/errorlogger.h src/tokenize.h src/settings.h src/token.h src/checkother.h
5052
g++ $(CFLAGS) -c $*.cpp
51-
testother.o: testother.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h checkother.h
53+
testother.o: test/testother.cpp test/testsuite.h src/errorlogger.h src/tokenize.h src/settings.h src/token.h src/checkother.h
5254
g++ $(CFLAGS) -c $*.cpp
53-
testmemleak.o: testmemleak.cpp tokenize.h settings.h errorlogger.h token.h checkmemoryleak.h testsuite.h
55+
testmemleak.o: test/testmemleak.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkmemoryleak.h test/testsuite.h
5456
g++ $(CFLAGS) -c $*.cpp
55-
testmemleakmp.o: testmemleakmp.cpp tokenize.h settings.h errorlogger.h token.h checkmemoryleak.h testsuite.h
57+
testmemleakmp.o: test/testmemleakmp.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkmemoryleak.h test/testsuite.h
5658
g++ $(CFLAGS) -c $*.cpp
57-
testpreprocessor.o: testpreprocessor.cpp testsuite.h errorlogger.h preprocessor.h
59+
testpreprocessor.o: test/testpreprocessor.cpp test/testsuite.h src/errorlogger.h src/preprocessor.h
5860
g++ $(CFLAGS) -c $*.cpp
59-
testredundantif.o: testredundantif.cpp testsuite.h errorlogger.h checkother.h
61+
testredundantif.o: test/testredundantif.cpp test/testsuite.h src/errorlogger.h src/checkother.h
6062
g++ $(CFLAGS) -c $*.cpp
61-
testrunner.o: testrunner.cpp testsuite.h errorlogger.h
63+
testrunner.o: test/testrunner.cpp test/testsuite.h src/errorlogger.h
6264
g++ $(CFLAGS) -c $*.cpp
63-
testsimplifytokens.o: testsimplifytokens.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h
65+
testsimplifytokens.o: test/testsimplifytokens.cpp test/testsuite.h src/errorlogger.h src/tokenize.h src/settings.h src/token.h
6466
g++ $(CFLAGS) -c $*.cpp
65-
testsuite.o: testsuite.cpp testsuite.h errorlogger.h
67+
testsuite.o: test/testsuite.cpp test/testsuite.h src/errorlogger.h
6668
g++ $(CFLAGS) -c $*.cpp
67-
testtoken.o: testtoken.cpp testsuite.h errorlogger.h token.h
69+
testtoken.o: test/testtoken.cpp test/testsuite.h src/errorlogger.h src/token.h
6870
g++ $(CFLAGS) -c $*.cpp
69-
testtokenize.o: testtokenize.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h
71+
testtokenize.o: test/testtokenize.cpp test/testsuite.h src/errorlogger.h src/tokenize.h src/settings.h src/token.h
7072
g++ $(CFLAGS) -c $*.cpp
71-
testunusedprivfunc.o: testunusedprivfunc.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
73+
testunusedprivfunc.o: test/testunusedprivfunc.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h test/testsuite.h
7274
g++ $(CFLAGS) -c $*.cpp
73-
testunusedvar.o: testunusedvar.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h checkother.h
75+
testunusedvar.o: test/testunusedvar.cpp test/testsuite.h src/errorlogger.h src/tokenize.h src/settings.h src/token.h src/checkother.h
7476
g++ $(CFLAGS) -c $*.cpp
75-
testfilelister.o: testfilelister.cpp filelister.h
77+
testfilelister.o: test/testfilelister.cpp src/filelister.h
7678
g++ $(CFLAGS) -c $*.cpp
77-
token.o: token.cpp token.h
79+
token.o: src/token.cpp src/token.h
7880
g++ $(CFLAGS) -c $*.cpp
79-
tokenize.o: tokenize.cpp tokenize.h settings.h errorlogger.h token.h filelister.h
81+
tokenize.o: src/tokenize.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/filelister.h
8082
g++ $(CFLAGS) -c $*.cpp
8183

8284
clean:
83-
rm -f *.o testrunner cppcheck
85+
rm -f src/*.o test/*.o testrunner cppcheck
8486
install: cppcheck
8587
install -d ${BIN}
8688
install cppcheck ${BIN}

cppcheck.cbp

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -30,59 +30,57 @@
3030
<Add option="-Wall" />
3131
<Add option="-fexceptions" />
3232
</Compiler>
33-
<Unit filename="checkbufferoverrun.cpp" />
34-
<Unit filename="checkbufferoverrun.h" />
35-
<Unit filename="checkclass.cpp" />
36-
<Unit filename="checkclass.h" />
37-
<Unit filename="checkfunctionusage.cpp" />
38-
<Unit filename="checkfunctionusage.h" />
39-
<Unit filename="checkheaders.cpp" />
40-
<Unit filename="checkheaders.h" />
41-
<Unit filename="checkmemoryleak.cpp" />
42-
<Unit filename="checkmemoryleak.h" />
43-
<Unit filename="checkother.cpp" />
44-
<Unit filename="checkother.h" />
45-
<Unit filename="cppcheck.cpp" />
46-
<Unit filename="cppcheck.h" />
47-
<Unit filename="cppcheckexecutor.cpp" />
48-
<Unit filename="cppcheckexecutor.h" />
49-
<Unit filename="errorlogger.h" />
50-
<Unit filename="errormessage.cpp" />
51-
<Unit filename="errormessage.h" />
52-
<Unit filename="filelister.cpp" />
53-
<Unit filename="filelister.h" />
54-
<Unit filename="main.cpp" />
55-
<Unit filename="preprocessor.cpp" />
56-
<Unit filename="preprocessor.h" />
57-
<Unit filename="settings.cpp" />
58-
<Unit filename="settings.h" />
59-
<Unit filename="testbufferoverrun.cpp" />
60-
<Unit filename="testcharvar.cpp" />
61-
<Unit filename="testclass.cpp" />
62-
<Unit filename="testconstructors.cpp" />
63-
<Unit filename="testdivision.cpp" />
64-
<Unit filename="testfilelister.cpp" />
65-
<Unit filename="testfunctionusage.cpp" />
66-
<Unit filename="testincompletestatement.cpp" />
67-
<Unit filename="testmemleak.cpp" />
68-
<Unit filename="testmemleakmp.cpp">
69-
<Option target="test" />
70-
</Unit>
71-
<Unit filename="testother.cpp" />
72-
<Unit filename="testpreprocessor.cpp" />
73-
<Unit filename="testredundantif.cpp" />
74-
<Unit filename="testrunner.cpp" />
75-
<Unit filename="testsimplifytokens.cpp" />
76-
<Unit filename="testsuite.cpp" />
77-
<Unit filename="testsuite.h" />
78-
<Unit filename="testtoken.cpp" />
79-
<Unit filename="testtokenize.cpp" />
80-
<Unit filename="testunusedprivfunc.cpp" />
81-
<Unit filename="testunusedvar.cpp" />
82-
<Unit filename="token.cpp" />
83-
<Unit filename="token.h" />
84-
<Unit filename="tokenize.cpp" />
85-
<Unit filename="tokenize.h" />
33+
<Unit filename="src/checkbufferoverrun.cpp" />
34+
<Unit filename="src/checkbufferoverrun.h" />
35+
<Unit filename="src/checkclass.cpp" />
36+
<Unit filename="src/checkclass.h" />
37+
<Unit filename="src/checkfunctionusage.cpp" />
38+
<Unit filename="src/checkfunctionusage.h" />
39+
<Unit filename="src/checkheaders.cpp" />
40+
<Unit filename="src/checkheaders.h" />
41+
<Unit filename="src/checkmemoryleak.cpp" />
42+
<Unit filename="src/checkmemoryleak.h" />
43+
<Unit filename="src/checkother.cpp" />
44+
<Unit filename="src/checkother.h" />
45+
<Unit filename="src/cppcheck.cpp" />
46+
<Unit filename="src/cppcheck.h" />
47+
<Unit filename="src/cppcheckexecutor.cpp" />
48+
<Unit filename="src/cppcheckexecutor.h" />
49+
<Unit filename="src/errorlogger.h" />
50+
<Unit filename="src/errormessage.cpp" />
51+
<Unit filename="src/errormessage.h" />
52+
<Unit filename="src/filelister.cpp" />
53+
<Unit filename="src/filelister.h" />
54+
<Unit filename="src/main.cpp" />
55+
<Unit filename="src/preprocessor.cpp" />
56+
<Unit filename="src/preprocessor.h" />
57+
<Unit filename="src/settings.cpp" />
58+
<Unit filename="src/settings.h" />
59+
<Unit filename="src/token.cpp" />
60+
<Unit filename="src/token.h" />
61+
<Unit filename="src/tokenize.cpp" />
62+
<Unit filename="src/tokenize.h" />
63+
<Unit filename="test/testbufferoverrun.cpp" />
64+
<Unit filename="test/testcharvar.cpp" />
65+
<Unit filename="test/testclass.cpp" />
66+
<Unit filename="test/testconstructors.cpp" />
67+
<Unit filename="test/testdivision.cpp" />
68+
<Unit filename="test/testfilelister.cpp" />
69+
<Unit filename="test/testfunctionusage.cpp" />
70+
<Unit filename="test/testincompletestatement.cpp" />
71+
<Unit filename="test/testmemleak.cpp" />
72+
<Unit filename="test/testmemleakmp.cpp" />
73+
<Unit filename="test/testother.cpp" />
74+
<Unit filename="test/testpreprocessor.cpp" />
75+
<Unit filename="test/testredundantif.cpp" />
76+
<Unit filename="test/testrunner.cpp" />
77+
<Unit filename="test/testsimplifytokens.cpp" />
78+
<Unit filename="test/testsuite.cpp" />
79+
<Unit filename="test/testsuite.h" />
80+
<Unit filename="test/testtoken.cpp" />
81+
<Unit filename="test/testtokenize.cpp" />
82+
<Unit filename="test/testunusedprivfunc.cpp" />
83+
<Unit filename="test/testunusedvar.cpp" />
8684
<Extensions>
8785
<code_completion />
8886
<debugger />

runastyle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
22

3-
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren *.cpp
4-
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren *.h
3+
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren src/*.cpp
4+
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren src/*.h
5+
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren test/*.cpp
6+
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren test/*.h
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)