summaryrefslogtreecommitdiff
path: root/share/qtcreator/cplusplus/examples/tidy_example.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2022-02-04 12:15:45 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2022-02-04 16:21:21 +0000
commit08535a7e6308c688924ea503a00cb807812197a8 (patch)
tree04f21d2354f6af47892febdc96667bdbaea53e38 /share/qtcreator/cplusplus/examples/tidy_example.cpp
parent96ec295fc6393770e91802ab5824333792369527 (diff)
downloadqt-creator-08535a7e6308c688924ea503a00cb807812197a8.tar.gz
Make share/qtcreator/cplusplus/examples compilable
Builds now, but does not link (which is fine). And unrelated, unintentional warnings were removed. Change-Id: I6ece33933bc20e6e36fb3859de7c2b774b0e67d5 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'share/qtcreator/cplusplus/examples/tidy_example.cpp')
-rw-r--r--share/qtcreator/cplusplus/examples/tidy_example.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/share/qtcreator/cplusplus/examples/tidy_example.cpp b/share/qtcreator/cplusplus/examples/tidy_example.cpp
index dc921114ea..0a814411ce 100644
--- a/share/qtcreator/cplusplus/examples/tidy_example.cpp
+++ b/share/qtcreator/cplusplus/examples/tidy_example.cpp
@@ -71,7 +71,7 @@ public:
// misc-noexcept-move-constructor
// misc-unconventional-assign-operator
// misc-unused-parameters
- Base operator=(Base &&param) {}
+ Base operator=(Base &&param) { return {}; }
virtual int function()
{
// modernize-use-nullptr
@@ -116,7 +116,7 @@ void afterMove(Base &&base)
Base moved(std::move(base));
// misc-use-after-move
- base.value;
+ (void) base.value;
}
// google-runtime-references
@@ -144,7 +144,7 @@ public:
auto b = {0.5f, 0.5f, 0.5f, 0.5f};
// misc-fold-init-type
- std::accumulate(std::begin(b), std::end(b), 0);
+ (void) std::accumulate(std::begin(b), std::end(b), 0);
// google-readability-casting, misc-incorrect-roundings
auto c = (int)(getDouble() + 0.5);
@@ -197,6 +197,7 @@ public:
std::system("echo ");
// cert-err52-cpp
setjmp(nullptr);
+ return 0;
}
// google-default-arguments
@@ -251,7 +252,7 @@ int main()
// modernize-loop-convert
for (int i = 0; i < 3; ++i) {
// cppcoreguidelines-pro-bounds-constant-array-index
- arr[i];
+ (void) arr[i];
}
std::vector<std::pair<int, int>> w;