Skip to content

Commit 68a7c4c

Browse files
committed
refactor: move and rename code in order to support a CMAKE_UNITY_BUILD
1 parent f97bab8 commit 68a7c4c

40 files changed

Lines changed: 239 additions & 217 deletions

gui/filelist.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void FileList::addExcludeList(const QStringList &paths)
108108
mExcludedPaths = paths;
109109
}
110110

111-
static std::vector<std::string> toStdStringList(const QStringList &stringList)
111+
static std::vector<std::string> toStdStringList2(const QStringList &stringList)
112112
{
113113
std::vector<std::string> ret;
114114
std::transform(stringList.cbegin(), stringList.cend(), std::back_inserter(ret), [](const QString& s) {
@@ -120,9 +120,9 @@ static std::vector<std::string> toStdStringList(const QStringList &stringList)
120120
QStringList FileList::applyExcludeList() const
121121
{
122122
#ifdef _WIN32
123-
const PathMatch pathMatch(toStdStringList(mExcludedPaths), true);
123+
const PathMatch pathMatch(toStdStringList2(mExcludedPaths), true);
124124
#else
125-
const PathMatch pathMatch(toStdStringList(mExcludedPaths), false);
125+
const PathMatch pathMatch(toStdStringList2(mExcludedPaths), false);
126126
#endif
127127

128128
QStringList paths;

gui/test/cppchecklibrarydata/testcppchecklibrarydata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
#pragma once
20+
1921
#include "cppchecklibrarydata.h"
2022

2123
#include <QObject>

gui/test/filelist/testfilelist.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
#pragma once
20+
1921
#include <QObject>
2022
#include <QString>
2123

gui/test/projectfile/testprojectfile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
#pragma once
20+
1921
#include <QObject>
2022
#include <QString>
2123

gui/test/translationhandler/testtranslationhandler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
#pragma once
20+
1921
#include <QObject>
2022
#include <QString>
2123

gui/test/xmlreportv2/testxmlreportv2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
#pragma once
20+
1921
#include <QObject>
2022
#include <QString>
2123

gui/xmlreport.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#include <QStringRef>
3030
#endif
3131

32-
static constexpr char ResultElementName[] = "results";
33-
static constexpr char VersionAttribute[] = "version";
32+
static constexpr char ResultElementName2[] = "results";
33+
static constexpr char VersionAttribute2[] = "version";
3434

3535
XmlReport::XmlReport(const QString &filename) :
3636
Report(filename)
@@ -70,10 +70,10 @@ int XmlReport::determineVersion(const QString &filename)
7070
while (!reader.atEnd()) {
7171
switch (reader.readNext()) {
7272
case QXmlStreamReader::StartElement:
73-
if (reader.name() == QString(ResultElementName)) {
73+
if (reader.name() == QString(ResultElementName2)) {
7474
QXmlStreamAttributes attribs = reader.attributes();
75-
if (attribs.hasAttribute(QString(VersionAttribute))) {
76-
const int ver = attribs.value(QString(), VersionAttribute).toString().toInt();
75+
if (attribs.hasAttribute(QString(VersionAttribute2))) {
76+
const int ver = attribs.value(QString(), VersionAttribute2).toString().toInt();
7777
return ver;
7878
}
7979
return 1;

lib/check64bit.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232

3333
//---------------------------------------------------------------------------
3434

35-
// CWE ids used
36-
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
3735

3836
// Register this check class (by creating a static instance of it)
3937
namespace {
40-
Check64BitPortability instance;
38+
Check64BitPortability instance64BitPortability;
4139
}
4240

4341
void Check64BitPortability::pointerassignment()

lib/checkassert.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@
3131

3232
//---------------------------------------------------------------------------
3333

34-
// CWE ids used
35-
static const CWE CWE398(398U); // Indicator of Poor Code Quality
3634

3735
// Register this check class (by creating a static instance of it)
3836
namespace {
39-
CheckAssert instance;
37+
CheckAssert instanceAssert;
4038
}
4139

4240
void CheckAssert::assertWithSideEffects()

lib/checkautovariables.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,9 @@
4242

4343
// Register this check class into cppcheck by creating a static instance of it..
4444
namespace {
45-
CheckAutoVariables instance;
45+
CheckAutoVariables instanceAutoVariables;
4646
}
4747

48-
static const CWE CWE398(398U); // Indicator of Poor Code Quality
49-
static const CWE CWE562(562U); // Return of Stack Variable Address
50-
static const CWE CWE590(590U); // Free of Memory not on the Heap
5148

5249
static bool isPtrArg(const Token *tok)
5350
{

0 commit comments

Comments
 (0)