Fixed #7275 - Make GUI tests buildable

* Use -std=c++11 flag for gcc and clang
 * Use $$PWD variable in qmake files to have correct paths
 * Change tokenizer.simplifyTokenList() to tokenizer.simplifyTokenList2()
 * Add build-generated files to .gitignore
 * Link libpcre only if rules are enabled
This commit is contained in:
Aleksandr Pikalev 2016-01-08 15:21:36 +01:00 committed by Daniel Marjamäki
parent bd2892fde4
commit e92bbf6481
9 changed files with 139 additions and 134 deletions

10
.gitignore vendored
View File

@ -55,6 +55,16 @@ gui/Makefile
gui/Makefile.debug gui/Makefile.debug
gui/Makefile.release gui/Makefile.release
gui/qrc_gui.cpp gui/qrc_gui.cpp
gui/test/Makefile
gui/test/*/Makefile
gui/test/*/*/Makefile
gui/test/benchmark/simple/benchmark-simple
gui/test/filelist/test-filelist
gui/test/projectfile/test-projectfile
gui/test/translationhandler/test-translationhandler
gui/test/xmlreport/test-xmlreport
gui/test/xmlreportv1/test-xmlreportv1
gui/test/xmlreportv2/test-xmlreportv2
# Doxygen output folder # Doxygen output folder
doxyoutput/ doxyoutput/

View File

@ -1,2 +1,2 @@
HEADERS += $${BASEPATH}tinyxml2.h HEADERS += $${PWD}/tinyxml2.h
SOURCES += $${BASEPATH}tinyxml2.cpp SOURCES += $${PWD}/tinyxml2.cpp

View File

@ -162,8 +162,6 @@ contains(QMAKE_CC, gcc) {
QMAKE_CXXFLAGS += -std=c++0x -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare QMAKE_CXXFLAGS += -std=c++0x -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare
} }
macx { contains(QMAKE_CXX, clang++) {
contains(QMAKE_CXX, clang++) { QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -std=c++11
}
} }

View File

@ -1,9 +0,0 @@
CONFIG += qtestlib
#DEPENDPATH += . ..
INCLUDEPATH += . ../.. ../../../../lib
LIBS += -L../../../../externals -lpcre
INCLUDEPATH += ../../../externals
BASEPATH = ../../../../lib/
include($$PWD/../../../lib/lib.pri)

View File

@ -57,7 +57,7 @@ void BenchmarkSimple::simplify()
std::istringstream istr(data.constData()); std::istringstream istr(data.constData());
tokenizer.tokenize(istr, "test.cpp"); tokenizer.tokenize(istr, "test.cpp");
QBENCHMARK { QBENCHMARK {
tokenizer.simplifyTokenList(); tokenizer.simplifyTokenList2();
} }
} }
@ -74,7 +74,7 @@ void BenchmarkSimple::tokenizeAndSimplify()
std::istringstream istr(data.constData()); std::istringstream istr(data.constData());
QBENCHMARK { QBENCHMARK {
tokenizer.tokenize(istr, "test.cpp"); tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList(); tokenizer.simplifyTokenList2();
} }
} }

View File

@ -5,7 +5,7 @@ INCLUDEPATH += .
OBJECTS_DIR = ../../build OBJECTS_DIR = ../../build
MOC_DIR = ../../build MOC_DIR = ../../build
include(../common.pri) include(../../common.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\" DEFINES += SRCDIR=\\\"$$PWD\\\"

View File

@ -1,28 +1,38 @@
CONFIG += qtestlib CONFIG += qtestlib
#DEPENDPATH += . .. greaterThan(QT_MAJOR_VERSION, 4) {
INCLUDEPATH += . ../.. ../../../lib QT += widgets # In Qt 5 widgets are in separate module
QT += printsupport # In Qt 5 QPrinter/QPrintDialog are in separate module
}
INCLUDEPATH += $${PWD}/..
LIBS += -L../../../externals -lpcre LIBS += -L$$PWD/../../externals
INCLUDEPATH += ../../externals INCLUDEPATH += $${PWD}/../../externals
BASEPATH = ../../../lib/ include($${PWD}/../../lib/lib.pri)
include($$PWD/../../lib/lib.pri)
# GUI # GUI
SOURCES += ../../erroritem.cpp \ SOURCES += $${PWD}/../erroritem.cpp \
../../filelist.cpp \ $${PWD}/../filelist.cpp \
../../projectfile.cpp \ $${PWD}/../projectfile.cpp \
../../report.cpp \ $${PWD}/../report.cpp \
../../translationhandler.cpp \ $${PWD}/../translationhandler.cpp \
../../xmlreport.cpp \ $${PWD}/../xmlreport.cpp \
../../xmlreportv1.cpp \ $${PWD}/../xmlreportv1.cpp \
../../xmlreportv2.cpp $${PWD}/../xmlreportv2.cpp
HEADERS += ../../erroritem.h \ HEADERS += $${PWD}/../erroritem.h \
../../filelist.h \ $${PWD}/../filelist.h \
../../projectfile.h \ $${PWD}/../projectfile.h \
../../report.h \ $${PWD}/../report.h \
../../translationhandler.h \ $${PWD}/../translationhandler.h \
../../xmlreport.h \ $${PWD}/../xmlreport.h \
../../xmlreportv1.h \ $${PWD}/../xmlreportv1.h \
../../xmlreportv2.h $${PWD}/../xmlreportv2.h
contains(QMAKE_CC, gcc) {
QMAKE_CXXFLAGS += -std=c++11
}
contains(QMAKE_CXX, clang++) {
QMAKE_CXXFLAGS += -std=c++11
}

View File

@ -1,94 +1,92 @@
# no manual edits - this file is autogenerated by dmake # no manual edits - this file is autogenerated by dmake
include($$PWD/pcrerules.pri) include($$PWD/pcrerules.pri)
BASEPATH = ../externals/tinyxml/
include($$PWD/../externals/tinyxml/tinyxml.pri) include($$PWD/../externals/tinyxml/tinyxml.pri)
BASEPATH = ../lib/ INCLUDEPATH += $$PWD $$PWD/../externals/tinyxml
INCLUDEPATH += ../externals/tinyxml HEADERS += $${PWD}/check.h \
HEADERS += $${BASEPATH}check.h \ $${PWD}/astutils.h \
$${BASEPATH}astutils.h \ $${PWD}/check.h \
$${BASEPATH}check.h \ $${PWD}/check64bit.h \
$${BASEPATH}check64bit.h \ $${PWD}/checkassert.h \
$${BASEPATH}checkassert.h \ $${PWD}/checkautovariables.h \
$${BASEPATH}checkautovariables.h \ $${PWD}/checkbool.h \
$${BASEPATH}checkbool.h \ $${PWD}/checkboost.h \
$${BASEPATH}checkboost.h \ $${PWD}/checkbufferoverrun.h \
$${BASEPATH}checkbufferoverrun.h \ $${PWD}/checkclass.h \
$${BASEPATH}checkclass.h \ $${PWD}/checkcondition.h \
$${BASEPATH}checkcondition.h \ $${PWD}/checkexceptionsafety.h \
$${BASEPATH}checkexceptionsafety.h \ $${PWD}/checkfunctions.h \
$${BASEPATH}checkfunctions.h \ $${PWD}/checkinternal.h \
$${BASEPATH}checkinternal.h \ $${PWD}/checkio.h \
$${BASEPATH}checkio.h \ $${PWD}/checkleakautovar.h \
$${BASEPATH}checkleakautovar.h \ $${PWD}/checkmemoryleak.h \
$${BASEPATH}checkmemoryleak.h \ $${PWD}/checknullpointer.h \
$${BASEPATH}checknullpointer.h \ $${PWD}/checkother.h \
$${BASEPATH}checkother.h \ $${PWD}/checkpostfixoperator.h \
$${BASEPATH}checkpostfixoperator.h \ $${PWD}/checksizeof.h \
$${BASEPATH}checksizeof.h \ $${PWD}/checkstl.h \
$${BASEPATH}checkstl.h \ $${PWD}/checkstring.h \
$${BASEPATH}checkstring.h \ $${PWD}/checktype.h \
$${BASEPATH}checktype.h \ $${PWD}/checkuninitvar.h \
$${BASEPATH}checkuninitvar.h \ $${PWD}/checkunusedfunctions.h \
$${BASEPATH}checkunusedfunctions.h \ $${PWD}/checkunusedvar.h \
$${BASEPATH}checkunusedvar.h \ $${PWD}/checkvaarg.h \
$${BASEPATH}checkvaarg.h \ $${PWD}/cppcheck.h \
$${BASEPATH}cppcheck.h \ $${PWD}/errorlogger.h \
$${BASEPATH}errorlogger.h \ $${PWD}/library.h \
$${BASEPATH}library.h \ $${PWD}/mathlib.h \
$${BASEPATH}mathlib.h \ $${PWD}/path.h \
$${BASEPATH}path.h \ $${PWD}/preprocessor.h \
$${BASEPATH}preprocessor.h \ $${PWD}/settings.h \
$${BASEPATH}settings.h \ $${PWD}/suppressions.h \
$${BASEPATH}suppressions.h \ $${PWD}/symboldatabase.h \
$${BASEPATH}symboldatabase.h \ $${PWD}/templatesimplifier.h \
$${BASEPATH}templatesimplifier.h \ $${PWD}/timer.h \
$${BASEPATH}timer.h \ $${PWD}/token.h \
$${BASEPATH}token.h \ $${PWD}/tokenize.h \
$${BASEPATH}tokenize.h \ $${PWD}/tokenlist.h \
$${BASEPATH}tokenlist.h \ $${PWD}/valueflow.h \
$${BASEPATH}valueflow.h \
SOURCES += $${BASEPATH}astutils.cpp \ SOURCES += $${PWD}/astutils.cpp \
$${BASEPATH}check.cpp \ $${PWD}/check.cpp \
$${BASEPATH}check64bit.cpp \ $${PWD}/check64bit.cpp \
$${BASEPATH}checkassert.cpp \ $${PWD}/checkassert.cpp \
$${BASEPATH}checkautovariables.cpp \ $${PWD}/checkautovariables.cpp \
$${BASEPATH}checkbool.cpp \ $${PWD}/checkbool.cpp \
$${BASEPATH}checkboost.cpp \ $${PWD}/checkboost.cpp \
$${BASEPATH}checkbufferoverrun.cpp \ $${PWD}/checkbufferoverrun.cpp \
$${BASEPATH}checkclass.cpp \ $${PWD}/checkclass.cpp \
$${BASEPATH}checkcondition.cpp \ $${PWD}/checkcondition.cpp \
$${BASEPATH}checkexceptionsafety.cpp \ $${PWD}/checkexceptionsafety.cpp \
$${BASEPATH}checkfunctions.cpp \ $${PWD}/checkfunctions.cpp \
$${BASEPATH}checkinternal.cpp \ $${PWD}/checkinternal.cpp \
$${BASEPATH}checkio.cpp \ $${PWD}/checkio.cpp \
$${BASEPATH}checkleakautovar.cpp \ $${PWD}/checkleakautovar.cpp \
$${BASEPATH}checkmemoryleak.cpp \ $${PWD}/checkmemoryleak.cpp \
$${BASEPATH}checknullpointer.cpp \ $${PWD}/checknullpointer.cpp \
$${BASEPATH}checkother.cpp \ $${PWD}/checkother.cpp \
$${BASEPATH}checkpostfixoperator.cpp \ $${PWD}/checkpostfixoperator.cpp \
$${BASEPATH}checksizeof.cpp \ $${PWD}/checksizeof.cpp \
$${BASEPATH}checkstl.cpp \ $${PWD}/checkstl.cpp \
$${BASEPATH}checkstring.cpp \ $${PWD}/checkstring.cpp \
$${BASEPATH}checktype.cpp \ $${PWD}/checktype.cpp \
$${BASEPATH}checkuninitvar.cpp \ $${PWD}/checkuninitvar.cpp \
$${BASEPATH}checkunusedfunctions.cpp \ $${PWD}/checkunusedfunctions.cpp \
$${BASEPATH}checkunusedvar.cpp \ $${PWD}/checkunusedvar.cpp \
$${BASEPATH}checkvaarg.cpp \ $${PWD}/checkvaarg.cpp \
$${BASEPATH}cppcheck.cpp \ $${PWD}/cppcheck.cpp \
$${BASEPATH}errorlogger.cpp \ $${PWD}/errorlogger.cpp \
$${BASEPATH}library.cpp \ $${PWD}/library.cpp \
$${BASEPATH}mathlib.cpp \ $${PWD}/mathlib.cpp \
$${BASEPATH}path.cpp \ $${PWD}/path.cpp \
$${BASEPATH}preprocessor.cpp \ $${PWD}/preprocessor.cpp \
$${BASEPATH}settings.cpp \ $${PWD}/settings.cpp \
$${BASEPATH}suppressions.cpp \ $${PWD}/suppressions.cpp \
$${BASEPATH}symboldatabase.cpp \ $${PWD}/symboldatabase.cpp \
$${BASEPATH}templatesimplifier.cpp \ $${PWD}/templatesimplifier.cpp \
$${BASEPATH}timer.cpp \ $${PWD}/timer.cpp \
$${BASEPATH}token.cpp \ $${PWD}/token.cpp \
$${BASEPATH}tokenize.cpp \ $${PWD}/tokenize.cpp \
$${BASEPATH}tokenlist.cpp \ $${PWD}/tokenlist.cpp \
$${BASEPATH}valueflow.cpp $${PWD}/valueflow.cpp

View File

@ -183,23 +183,21 @@ int main(int argc, char **argv)
if (fout1.is_open()) { if (fout1.is_open()) {
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n"; fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
fout1 << "include($$PWD/pcrerules.pri)\n"; fout1 << "include($$PWD/pcrerules.pri)\n";
fout1 << "BASEPATH = ../externals/tinyxml/\n";
fout1 << "include($$PWD/../externals/tinyxml/tinyxml.pri)\n"; fout1 << "include($$PWD/../externals/tinyxml/tinyxml.pri)\n";
fout1 << "BASEPATH = ../lib/\n"; fout1 << "INCLUDEPATH += $$PWD $$PWD/../externals/tinyxml\n";
fout1 << "INCLUDEPATH += ../externals/tinyxml\n"; fout1 << "HEADERS += $${PWD}/check.h \\\n";
fout1 << "HEADERS += $${BASEPATH}check.h \\\n";
for (unsigned int i = 0; i < libfiles.size(); ++i) { for (unsigned int i = 0; i < libfiles.size(); ++i) {
std::string fname(libfiles[i].substr(4)); std::string fname(libfiles[i].substr(4));
if (fname.find(".cpp") == std::string::npos) if (fname.find(".cpp") == std::string::npos)
continue; // shouldn't happen continue; // shouldn't happen
fname.erase(fname.find(".cpp")); fname.erase(fname.find(".cpp"));
fout1 << std::string(11, ' ') << "$${BASEPATH}" << fname << ".h"; fout1 << std::string(11, ' ') << "$${PWD}/" << fname << ".h";
if (i + 1 < testfiles.size()) if (i + 1 < testfiles.size())
fout1 << " \\\n"; fout1 << " \\\n";
} }
fout1 << "\n\nSOURCES += "; fout1 << "\n\nSOURCES += ";
for (unsigned int i = 0; i < libfiles.size(); ++i) { for (unsigned int i = 0; i < libfiles.size(); ++i) {
fout1 << "$${BASEPATH}" << libfiles[i].substr(4); fout1 << "$${PWD}/" << libfiles[i].substr(4);
if (i < libfiles.size() - 1) if (i < libfiles.size() - 1)
fout1 << " \\\n" << std::string(11, ' '); fout1 << " \\\n" << std::string(11, ' ');
} }