Skip to content

Commit 75ec331

Browse files
authored
replaced QPair with std::pair (danmar#7329)
it is just an alias
1 parent 16e4dac commit 75ec331

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

Diff for: gui/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CheckOptions:
99
- { key: HeaderFileExtensions, value: 'x' }
1010
")
1111

12+
# TODO: limit to target
1213
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
1314
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT>)
1415
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_WARNING_OUTPUT>)
@@ -77,6 +78,7 @@ CheckOptions:
7778
# caused by Qt generated moc code
7879
target_compile_options_safe(cppcheck-gui -Wno-redundant-parens)
7980
endif()
81+
#target_compile_definitions(cppcheck-gui PRIVATE -DQT_NO_QPAIR) # TODO: cannot be completely disabled because QBrush uses QPair
8082

8183
if (QHELPGENERATOR)
8284
# TODO: generate in CMAKE_BINARY_DIR folder

Diff for: gui/cppchecklibrarydata.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <stdexcept>
2424
#include <string>
25+
#include <utility>
2526

2627
#include <QObject>
2728
#include <QVariant>
@@ -147,7 +148,7 @@ static CppcheckLibraryData::TypeChecks loadTypeChecks(QXmlStreamReader &xmlReade
147148
continue;
148149
const QString elementName = xmlReader.name().toString();
149150
if (elementName == "suppress" || elementName == "check") {
150-
QPair<QString, QString> entry(elementName, xmlReader.readElementText());
151+
std::pair<QString, QString> entry(elementName, xmlReader.readElementText());
151152
typeChecks.append(entry);
152153
}
153154
}
@@ -756,7 +757,7 @@ static void writeTypeChecks(QXmlStreamWriter &xmlWriter, const CppcheckLibraryDa
756757
if (!typeChecks.isEmpty()) {
757758
xmlWriter.writeStartElement("unusedvar");
758759
}
759-
for (const QPair<QString, QString> &check : typeChecks) {
760+
for (const std::pair<QString, QString> &check : typeChecks) {
760761
xmlWriter.writeStartElement(check.first);
761762
xmlWriter.writeCharacters(check.second);
762763
xmlWriter.writeEndElement();

Diff for: gui/cppchecklibrarydata.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#include "config.h"
2323

2424
#include <cstdint>
25+
#include <utility>
2526

2627
#include <QList>
2728
#include <QMap>
28-
#include <QPair>
2929
#include <QString>
3030
#include <QStringList>
3131

@@ -171,7 +171,7 @@ class CppcheckLibraryData {
171171
QStringList platforms; // Keeps "type" attribute of each "platform" element
172172
};
173173

174-
using TypeChecks = QList<QPair<QString, QString>>;
174+
using TypeChecks = QList<std::pair<QString, QString>>;
175175

176176
struct Reflection {
177177
struct Call {

Diff for: gui/mainwindow.h

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <QFileDialog>
2828
#include <QMainWindow>
2929
#include <QObject>
30-
#include <QPair>
3130
#include <QString>
3231
#include <QStringList>
3332

Diff for: gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <QFile>
2424
#include <QIODevice>
2525
#include <QList>
26-
#include <QPair>
2726
#include <QStringList>
2827
#include <QTextStream>
2928
#include <QtTest>

Diff for: tools/triage/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CheckOptions:
88
- { key: HeaderFileExtensions, value: 'x' }
99
")
1010

11+
# TODO: limit to target
1112
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
1213
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT>)
1314
add_compile_definitions($<$<NOT:$<CONFIG:Debug>>:QT_NO_WARNING_OUTPUT>)
@@ -36,4 +37,5 @@ CheckOptions:
3637
# caused by Qt generated moc code
3738
target_compile_options_safe(triage -Wno-redundant-parens)
3839
endif()
40+
#target_compile_definitions(triage PRIVATE -DQT_NO_QPAIR) # TODO: cannot be completely disabled because QBrush uses QPair
3941
endif()

0 commit comments

Comments
 (0)